public function UrlGeneratorTest::testLegacyGenerateNetworkPath in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/routing/Tests/Generator/UrlGeneratorTest.php \Symfony\Component\Routing\Tests\Generator\UrlGeneratorTest::testLegacyGenerateNetworkPath()
@group legacy
File
- vendor/
symfony/ routing/ Tests/ Generator/ UrlGeneratorTest.php, line 462
Class
Namespace
Symfony\Component\Routing\Tests\GeneratorCode
public function testLegacyGenerateNetworkPath() {
$routes = $this
->getRoutes('test', new Route('/{name}', array(), array(
'_scheme' => 'http',
), array(), '{locale}.example.com'));
$this
->assertSame('//fr.example.com/app.php/Fabien', $this
->getGenerator($routes)
->generate('test', array(
'name' => 'Fabien',
'locale' => 'fr',
), UrlGeneratorInterface::NETWORK_PATH), 'network path with different host');
$this
->assertSame('//fr.example.com/app.php/Fabien?query=string', $this
->getGenerator($routes, array(
'host' => 'fr.example.com',
))
->generate('test', array(
'name' => 'Fabien',
'locale' => 'fr',
'query' => 'string',
), UrlGeneratorInterface::NETWORK_PATH), 'network path although host same as context');
$this
->assertSame('http://fr.example.com/app.php/Fabien', $this
->getGenerator($routes, array(
'scheme' => 'https',
))
->generate('test', array(
'name' => 'Fabien',
'locale' => 'fr',
), UrlGeneratorInterface::NETWORK_PATH), 'absolute URL because scheme requirement does not match context');
$this
->assertSame('http://fr.example.com/app.php/Fabien', $this
->getGenerator($routes)
->generate('test', array(
'name' => 'Fabien',
'locale' => 'fr',
), UrlGeneratorInterface::ABSOLUTE_URL), 'absolute URL with same scheme because it is requested');
}