minor #19554 [Routing] Reorder assert parameters (Ener-Getick)
This PR was merged into the 2.7 branch.
Discussion
----------
[Routing] Reorder assert parameters
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
The expected value must be the first parameter.
Commits
-------
7f88796
[Routing] Reorder assert parameters
This commit is contained in:
commit
00e2a42d8a
@ -77,10 +77,10 @@ class PhpGeneratorDumperTest extends \PHPUnit_Framework_TestCase
|
|||||||
$relativeUrlWithParameter = $projectUrlGenerator->generate('Test', array('foo' => 'bar'), UrlGeneratorInterface::ABSOLUTE_PATH);
|
$relativeUrlWithParameter = $projectUrlGenerator->generate('Test', array('foo' => 'bar'), UrlGeneratorInterface::ABSOLUTE_PATH);
|
||||||
$relativeUrlWithoutParameter = $projectUrlGenerator->generate('Test2', array(), UrlGeneratorInterface::ABSOLUTE_PATH);
|
$relativeUrlWithoutParameter = $projectUrlGenerator->generate('Test2', array(), UrlGeneratorInterface::ABSOLUTE_PATH);
|
||||||
|
|
||||||
$this->assertEquals($absoluteUrlWithParameter, 'http://localhost/app.php/testing/bar');
|
$this->assertEquals('http://localhost/app.php/testing/bar', $absoluteUrlWithParameter);
|
||||||
$this->assertEquals($absoluteUrlWithoutParameter, 'http://localhost/app.php/testing2');
|
$this->assertEquals('http://localhost/app.php/testing2', $absoluteUrlWithoutParameter);
|
||||||
$this->assertEquals($relativeUrlWithParameter, '/app.php/testing/bar');
|
$this->assertEquals('/app.php/testing/bar', $relativeUrlWithParameter);
|
||||||
$this->assertEquals($relativeUrlWithoutParameter, '/app.php/testing2');
|
$this->assertEquals('/app.php/testing2', $relativeUrlWithoutParameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDumpWithTooManyRoutes()
|
public function testDumpWithTooManyRoutes()
|
||||||
@ -108,10 +108,10 @@ class PhpGeneratorDumperTest extends \PHPUnit_Framework_TestCase
|
|||||||
$relativeUrlWithParameter = $projectUrlGenerator->generate('Test', array('foo' => 'bar'), UrlGeneratorInterface::ABSOLUTE_PATH);
|
$relativeUrlWithParameter = $projectUrlGenerator->generate('Test', array('foo' => 'bar'), UrlGeneratorInterface::ABSOLUTE_PATH);
|
||||||
$relativeUrlWithoutParameter = $projectUrlGenerator->generate('Test2', array(), UrlGeneratorInterface::ABSOLUTE_PATH);
|
$relativeUrlWithoutParameter = $projectUrlGenerator->generate('Test2', array(), UrlGeneratorInterface::ABSOLUTE_PATH);
|
||||||
|
|
||||||
$this->assertEquals($absoluteUrlWithParameter, 'http://localhost/app.php/testing/bar');
|
$this->assertEquals('http://localhost/app.php/testing/bar', $absoluteUrlWithParameter);
|
||||||
$this->assertEquals($absoluteUrlWithoutParameter, 'http://localhost/app.php/testing2');
|
$this->assertEquals('http://localhost/app.php/testing2', $absoluteUrlWithoutParameter);
|
||||||
$this->assertEquals($relativeUrlWithParameter, '/app.php/testing/bar');
|
$this->assertEquals('/app.php/testing/bar', $relativeUrlWithParameter);
|
||||||
$this->assertEquals($relativeUrlWithoutParameter, '/app.php/testing2');
|
$this->assertEquals('/app.php/testing2', $relativeUrlWithoutParameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -151,7 +151,7 @@ class PhpGeneratorDumperTest extends \PHPUnit_Framework_TestCase
|
|||||||
$projectUrlGenerator = new \DefaultRoutesUrlGenerator(new RequestContext());
|
$projectUrlGenerator = new \DefaultRoutesUrlGenerator(new RequestContext());
|
||||||
$url = $projectUrlGenerator->generate('Test', array());
|
$url = $projectUrlGenerator->generate('Test', array());
|
||||||
|
|
||||||
$this->assertEquals($url, '/testing');
|
$this->assertEquals('/testing', $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDumpWithSchemeRequirement()
|
public function testDumpWithSchemeRequirement()
|
||||||
@ -166,15 +166,15 @@ class PhpGeneratorDumperTest extends \PHPUnit_Framework_TestCase
|
|||||||
$absoluteUrl = $projectUrlGenerator->generate('Test1', array(), UrlGeneratorInterface::ABSOLUTE_URL);
|
$absoluteUrl = $projectUrlGenerator->generate('Test1', array(), UrlGeneratorInterface::ABSOLUTE_URL);
|
||||||
$relativeUrl = $projectUrlGenerator->generate('Test1', array(), UrlGeneratorInterface::ABSOLUTE_PATH);
|
$relativeUrl = $projectUrlGenerator->generate('Test1', array(), UrlGeneratorInterface::ABSOLUTE_PATH);
|
||||||
|
|
||||||
$this->assertEquals($absoluteUrl, 'ftp://localhost/app.php/testing');
|
$this->assertEquals('ftp://localhost/app.php/testing', $absoluteUrl);
|
||||||
$this->assertEquals($relativeUrl, 'ftp://localhost/app.php/testing');
|
$this->assertEquals('ftp://localhost/app.php/testing', $relativeUrl);
|
||||||
|
|
||||||
$projectUrlGenerator = new \SchemeUrlGenerator(new RequestContext('/app.php', 'GET', 'localhost', 'https'));
|
$projectUrlGenerator = new \SchemeUrlGenerator(new RequestContext('/app.php', 'GET', 'localhost', 'https'));
|
||||||
|
|
||||||
$absoluteUrl = $projectUrlGenerator->generate('Test1', array(), UrlGeneratorInterface::ABSOLUTE_URL);
|
$absoluteUrl = $projectUrlGenerator->generate('Test1', array(), UrlGeneratorInterface::ABSOLUTE_URL);
|
||||||
$relativeUrl = $projectUrlGenerator->generate('Test1', array(), UrlGeneratorInterface::ABSOLUTE_PATH);
|
$relativeUrl = $projectUrlGenerator->generate('Test1', array(), UrlGeneratorInterface::ABSOLUTE_PATH);
|
||||||
|
|
||||||
$this->assertEquals($absoluteUrl, 'https://localhost/app.php/testing');
|
$this->assertEquals('https://localhost/app.php/testing', $absoluteUrl);
|
||||||
$this->assertEquals($relativeUrl, '/app.php/testing');
|
$this->assertEquals('/app.php/testing', $relativeUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user