From 6962c2b790b5428699fe5897de840d41090fcd37 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Sat, 31 Mar 2018 05:19:49 +0200 Subject: Legacy URL Support --- tests/Unit/Routing/LegacyUrlGeneratorTest.php | 54 +++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 tests/Unit/Routing/LegacyUrlGeneratorTest.php (limited to 'tests/Unit/Routing/LegacyUrlGeneratorTest.php') diff --git a/tests/Unit/Routing/LegacyUrlGeneratorTest.php b/tests/Unit/Routing/LegacyUrlGeneratorTest.php new file mode 100644 index 00000000..63e1a3eb --- /dev/null +++ b/tests/Unit/Routing/LegacyUrlGeneratorTest.php @@ -0,0 +1,54 @@ + 'abc'], 'http://foo.bar/index.php?p=foo&test=abc'], + ]; + } + + /** + * @dataProvider provideLinksTo + * @covers \Engelsystem\Routing\LegacyUrlGenerator::to + * + * @param string $urlToPath + * @param string $willReturn + * @param string[] $arguments + * @param string $expectedUrl + */ + public function testTo($urlToPath, $willReturn, $arguments, $expectedUrl) + { + $app = new Container(); + Application::setInstance($app); + + $request = $this->getMockBuilder(Request::class) + ->getMock(); + + $request->expects($this->once()) + ->method('getUriForPath') + ->with('/index.php') + ->willReturn($willReturn); + + $app->instance('request', $request); + + $urlGenerator = new LegacyUrlGenerator(); + $this->assertInstanceOf(UrlGeneratorInterface::class, $urlGenerator); + + $url = $urlGenerator->to($urlToPath, $arguments); + $this->assertEquals($expectedUrl, $url); + } +} -- cgit v1.2.3-54-g00ecf