Renamed RoutingServiceProvider to Http\UrlGeneratorServiceProvider

This commit is contained in:
Igor Scheller 2018-08-22 03:10:08 +02:00
parent b0e7bc0df2
commit 73c9d923e7
7 changed files with 17 additions and 17 deletions

View File

@ -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,

View File

@ -1,6 +1,6 @@
<?php
namespace Engelsystem\Routing;
namespace Engelsystem\Http;
class UrlGenerator
{

View File

@ -1,14 +1,14 @@
<?php
namespace Engelsystem\Routing;
namespace Engelsystem\Http;
use Engelsystem\Container\ServiceProvider;
class RoutingServiceProvider extends ServiceProvider
class UrlGeneratorServiceProvider extends ServiceProvider
{
public function register()
{
$urlGenerator = $this->app->make(UrlGenerator::class);
$this->app->instance('routing.urlGenerator', $urlGenerator);
$this->app->instance('http.urlGenerator', $urlGenerator);
}
}

View File

@ -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;

View File

@ -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())

View File

@ -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();
}
}

View File

@ -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