diff options
Diffstat (limited to 'tests/Unit/Routing')
-rw-r--r-- | tests/Unit/Routing/RoutingServiceProviderTest.php | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/Unit/Routing/RoutingServiceProviderTest.php b/tests/Unit/Routing/RoutingServiceProviderTest.php new file mode 100644 index 00000000..4f1cd5fc --- /dev/null +++ b/tests/Unit/Routing/RoutingServiceProviderTest.php @@ -0,0 +1,39 @@ +<?php + +namespace Engelsystem\Test\Routing; + +use Engelsystem\Application; +use Engelsystem\Routing\RoutingServiceProvider; +use Engelsystem\Routing\UrlGenerator; +use PHPUnit\Framework\TestCase; +use PHPUnit_Framework_MockObject_MockObject; + +class RoutingServiceProviderTest extends TestCase +{ + /** + * @covers \Engelsystem\Routing\RoutingServiceProvider::register() + */ + public function testRegister() + { + /** @var PHPUnit_Framework_MockObject_MockObject|UrlGenerator $urlGenerator */ + $urlGenerator = $this->getMockBuilder(UrlGenerator::class) + ->getMock(); + + /** @var PHPUnit_Framework_MockObject_MockObject|Application $app */ + $app = $this->getMockBuilder(Application::class) + ->setMethods(['make', 'instance']) + ->getMock(); + + $app->expects($this->once()) + ->method('make') + ->with(UrlGenerator::class) + ->willReturn($urlGenerator); + + $app->expects($this->once()) + ->method('instance') + ->with('routing.urlGenerator', $urlGenerator); + + $serviceProvider = new RoutingServiceProvider($app); + $serviceProvider->register(); + } +} |