diff --git a/drupal/core/lib/Drupal/Core/Routing/CachedUrlGenerator.php b/drupal/core/lib/Drupal/Core/Routing/CachedUrlGenerator.php index 0bb9a47..e9fc868 100644 --- a/drupal/core/lib/Drupal/Core/Routing/CachedUrlGenerator.php +++ b/drupal/core/lib/Drupal/Core/Routing/CachedUrlGenerator.php @@ -11,7 +11,7 @@ use Drupal\Core\DestructableInterface; use Drupal\Core\Language\Language; use Drupal\Core\Language\LanguageManagerInterface; -use Symfony\Cmf\Component\Routing\RouteProviderInterface; +use Symfony\Cmf\Component\Routing\RouteProviderInterface as SymfonyRouteProviderInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\RequestContext as SymfonyRequestContext; @@ -91,7 +91,7 @@ class CachedUrlGenerator implements DestructableInterface, CachedUrlGeneratorInt * @param \Symfony\Cmf\Component\Routing\RouteProviderInterface $route_provider * The route provider. */ - public function __construct(UrlGeneratorInterface $url_generator, CacheBackendInterface $cache, LanguageManagerInterface $language_manager, RouteProviderInterface $route_provider) { + public function __construct(UrlGeneratorInterface $url_generator, CacheBackendInterface $cache, LanguageManagerInterface $language_manager, SymfonyRouteProviderInterface $route_provider) { $this->urlGenerator = $url_generator; $this->cache = $cache; $this->languageManager = $language_manager; diff --git a/drupal/core/tests/Drupal/Tests/Core/Routing/CachedUrlGeneratorTest.php b/drupal/core/tests/Drupal/Tests/Core/Routing/CachedUrlGeneratorTest.php index b5b0ec3..42dd4de 100644 --- a/drupal/core/tests/Drupal/Tests/Core/Routing/CachedUrlGeneratorTest.php +++ b/drupal/core/tests/Drupal/Tests/Core/Routing/CachedUrlGeneratorTest.php @@ -12,13 +12,15 @@ /** * Tests the cache url generator. + * + * @group Routing */ class CachedUrlGeneratorTest extends UnitTestCase { /** * The wrapped url generator. * - * @var \Drupal\Core\Routing\PathBasedGeneratorInterface|\PHPUnit_Framework_MockObject_MockObject + * @var \Drupal\Core\Routing\UrlGeneratorInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $urlGenerator; @@ -37,19 +39,25 @@ class CachedUrlGeneratorTest extends UnitTestCase { protected $languageManager; /** + * Route Provider front-end for all Drupal-stored routes. + * + * @var \Symfony\Cmf\Component\Routing\RouteProviderInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $routeProvider; + + /** * The actual tested cached url generator. * * @var \Drupal\Core\Routing\CachedUrlGenerator */ protected $cachedUrlGenerator; - public static function getInfo() { - return array( - 'name' => 'Cached UrlGenerator', - 'description' => 'Confirm that the cached UrlGenerator is functioning properly.', - 'group' => 'Routing', - ); - } + /** + * The route object. + * + * @var \Symfony\Component\Routing\Route|\PHPUnit_Framework_MockObject_MockObject + */ + protected $route; /** * {@inheritdoc} @@ -60,8 +68,14 @@ protected function setUp() { $this->urlGenerator = $this->getMock('Drupal\Core\Routing\UrlGeneratorInterface'); $this->cache = $this->getMock('Drupal\Core\Cache\CacheBackendInterface'); $this->languageManager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface'); - - $this->cachedUrlGenerator = new CachedUrlGenerator($this->urlGenerator, $this->cache, $this->languageManager); + $this->routeProvider = $this->getMock('Symfony\Cmf\Component\Routing\RouteProviderInterface'); + $this->route = $this->getMockBuilder('Symfony\Component\Routing\Route') + ->disableOriginalConstructor() + ->getMock(); + $this->routeProvider->expects($this->any()) + ->method('getRouteByName') + ->willReturn($this->route); + $this->cachedUrlGenerator = new CachedUrlGenerator($this->urlGenerator, $this->cache, $this->languageManager, $this->routeProvider); } /**