public function PhpGeneratorDumperTest::testDumpWithSchemeRequirement in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php \Symfony\Component\Routing\Tests\Generator\Dumper\PhpGeneratorDumperTest::testDumpWithSchemeRequirement()
File
- vendor/
symfony/ routing/ Tests/ Generator/ Dumper/ PhpGeneratorDumperTest.php, line 118
Class
Namespace
Symfony\Component\Routing\Tests\Generator\DumperCode
public function testDumpWithSchemeRequirement() {
$this->routeCollection
->add('Test1', new Route('/testing', array(), array(), array(), '', array(
'ftp',
'https',
)));
file_put_contents($this->testTmpFilepath, $this->generatorDumper
->dump(array(
'class' => 'SchemeUrlGenerator',
)));
include $this->testTmpFilepath;
$projectUrlGenerator = new \SchemeUrlGenerator(new RequestContext('/app.php'));
$absoluteUrl = $projectUrlGenerator
->generate('Test1', array(), true);
$relativeUrl = $projectUrlGenerator
->generate('Test1', array(), false);
$this
->assertEquals($absoluteUrl, 'ftp://localhost/app.php/testing');
$this
->assertEquals($relativeUrl, 'ftp://localhost/app.php/testing');
$projectUrlGenerator = new \SchemeUrlGenerator(new RequestContext('/app.php', 'GET', 'localhost', 'https'));
$absoluteUrl = $projectUrlGenerator
->generate('Test1', array(), true);
$relativeUrl = $projectUrlGenerator
->generate('Test1', array(), false);
$this
->assertEquals($absoluteUrl, 'https://localhost/app.php/testing');
$this
->assertEquals($relativeUrl, '/app.php/testing');
}