unlink($this->testTmpFilepath
);
} public function testDumpWithRoutes() { $this->routeCollection->
add('Test',
new Route('/testing/{foo}'
));
$this->routeCollection->
add('Test2',
new Route('/testing2'
));
file_put_contents($this->testTmpFilepath,
$this->generatorDumper->
dump());
$projectUrlGenerator =
new CompiledUrlGenerator(require $this->testTmpFilepath,
new RequestContext('/app.php'
));
$absoluteUrlWithParameter =
$projectUrlGenerator->
generate('Test',
['foo' => 'bar'
], UrlGeneratorInterface::ABSOLUTE_URL
);
$absoluteUrlWithoutParameter =
$projectUrlGenerator->
generate('Test2',
[], UrlGeneratorInterface::ABSOLUTE_URL
);
$relativeUrlWithParameter =
$projectUrlGenerator->
generate('Test',
['foo' => 'bar'
], UrlGeneratorInterface::ABSOLUTE_PATH
);
$relativeUrlWithoutParameter =
$projectUrlGenerator->
generate('Test2',
[], UrlGeneratorInterface::ABSOLUTE_PATH
);
$this->
assertEquals('http://localhost/app.php/testing/bar',
$absoluteUrlWithParameter);
$this->
assertEquals('http://localhost/app.php/testing2',
$absoluteUrlWithoutParameter);
$this->
assertEquals('/app.php/testing/bar',
$relativeUrlWithParameter);
$this->
assertEquals('/app.php/testing2',
$relativeUrlWithoutParameter);
}