diff --git a/config/app.php b/config/app.php index bb405fde..6278f193 100644 --- a/config/app.php +++ b/config/app.php @@ -8,7 +8,7 @@ return [ \Engelsystem\Logger\LoggerServiceProvider::class, \Engelsystem\Exceptions\ExceptionsServiceProvider::class, \Engelsystem\Config\ConfigServiceProvider::class, - \Engelsystem\Routing\RoutingServiceProvider::class, + \Engelsystem\Http\UrlGeneratorServiceProvider::class, \Engelsystem\Renderer\RendererServiceProvider::class, \Engelsystem\Database\DatabaseServiceProvider::class, \Engelsystem\Http\RequestServiceProvider::class, diff --git a/src/Routing/UrlGenerator.php b/src/Http/UrlGenerator.php similarity index 94% rename from src/Routing/UrlGenerator.php rename to src/Http/UrlGenerator.php index 6df52425..132fefc7 100644 --- a/src/Routing/UrlGenerator.php +++ b/src/Http/UrlGenerator.php @@ -1,6 +1,6 @@ app->make(UrlGenerator::class); - $this->app->instance('routing.urlGenerator', $urlGenerator); + $this->app->instance('http.urlGenerator', $urlGenerator); } } diff --git a/src/helpers.php b/src/helpers.php index 01fb10bd..a90b2462 100644 --- a/src/helpers.php +++ b/src/helpers.php @@ -6,7 +6,7 @@ use Engelsystem\Config\Config; use Engelsystem\Http\Request; use Engelsystem\Http\Response; use Engelsystem\Renderer\Renderer; -use Engelsystem\Routing\UrlGenerator; +use Engelsystem\Http\UrlGenerator; use Symfony\Component\HttpFoundation\Session\SessionInterface; /** @@ -125,7 +125,7 @@ function session($key = null, $default = null) */ function url($path = null, $parameters = []) { - $urlGenerator = app('routing.urlGenerator'); + $urlGenerator = app('http.urlGenerator'); if (is_null($path)) { return $urlGenerator; diff --git a/tests/Unit/HelpersTest.php b/tests/Unit/HelpersTest.php index 82030169..b59b11ee 100644 --- a/tests/Unit/HelpersTest.php +++ b/tests/Unit/HelpersTest.php @@ -8,7 +8,7 @@ use Engelsystem\Container\Container; use Engelsystem\Http\Request; use Engelsystem\Http\Response; use Engelsystem\Renderer\Renderer; -use Engelsystem\Routing\UrlGenerator; +use Engelsystem\Http\UrlGenerator; use PHPUnit\Framework\TestCase; use PHPUnit_Framework_MockObject_MockObject as MockObject; use Symfony\Component\HttpFoundation\Session\Session; @@ -202,7 +202,7 @@ class HelpersTest extends TestCase $urlGeneratorMock = $this->getMockBuilder(UrlGenerator::class) ->getMock(); - $this->getAppMock('routing.urlGenerator', $urlGeneratorMock); + $this->getAppMock('http.urlGenerator', $urlGeneratorMock); $this->assertEquals($urlGeneratorMock, url()); $urlGeneratorMock->expects($this->once()) diff --git a/tests/Unit/Routing/RoutingServiceProviderTest.php b/tests/Unit/Http/UrlGeneratorServiceProviderTest.php similarity index 59% rename from tests/Unit/Routing/RoutingServiceProviderTest.php rename to tests/Unit/Http/UrlGeneratorServiceProviderTest.php index dd9441eb..f3d5e018 100644 --- a/tests/Unit/Routing/RoutingServiceProviderTest.php +++ b/tests/Unit/Http/UrlGeneratorServiceProviderTest.php @@ -2,15 +2,15 @@ namespace Engelsystem\Test\Unit\Routing; -use Engelsystem\Routing\RoutingServiceProvider; -use Engelsystem\Routing\UrlGenerator; +use Engelsystem\Http\UrlGenerator; +use Engelsystem\Http\UrlGeneratorServiceProvider; use Engelsystem\Test\Unit\ServiceProviderTest; use PHPUnit_Framework_MockObject_MockObject; -class RoutingServiceProviderTest extends ServiceProviderTest +class UrlGeneratorServiceProviderTest extends ServiceProviderTest { /** - * @covers \Engelsystem\Routing\RoutingServiceProvider::register() + * @covers \Engelsystem\Http\UrlGeneratorServiceProvider::register() */ public function testRegister() { @@ -21,9 +21,9 @@ class RoutingServiceProviderTest extends ServiceProviderTest $app = $this->getApp(); $this->setExpects($app, 'make', [UrlGenerator::class], $urlGenerator); - $this->setExpects($app, 'instance', ['routing.urlGenerator', $urlGenerator]); + $this->setExpects($app, 'instance', ['http.urlGenerator', $urlGenerator]); - $serviceProvider = new RoutingServiceProvider($app); + $serviceProvider = new UrlGeneratorServiceProvider($app); $serviceProvider->register(); } } diff --git a/tests/Unit/Routing/UrlGeneratorTest.php b/tests/Unit/Http/UrlGeneratorTest.php similarity index 93% rename from tests/Unit/Routing/UrlGeneratorTest.php rename to tests/Unit/Http/UrlGeneratorTest.php index 6da59a4f..89ffa7dd 100644 --- a/tests/Unit/Routing/UrlGeneratorTest.php +++ b/tests/Unit/Http/UrlGeneratorTest.php @@ -5,7 +5,7 @@ namespace Engelsystem\Test\Unit\Routing; use Engelsystem\Application; use Engelsystem\Container\Container; use Engelsystem\Http\Request; -use Engelsystem\Routing\UrlGenerator; +use Engelsystem\Http\UrlGenerator; use PHPUnit\Framework\TestCase; class UrlGeneratorTest extends TestCase @@ -21,7 +21,7 @@ class UrlGeneratorTest extends TestCase /** * @dataProvider provideLinksTo - * @covers \Engelsystem\Routing\UrlGenerator::to + * @covers \Engelsystem\Http\UrlGenerator::to * * @param string $path * @param string $willReturn