Issue #3097883 by longwave, andypost: Remove all @deprecated code in \Drupal\Core\Routing
parent
30ec97cb25
commit
7031d8ffd3
|
@ -323,7 +323,7 @@ class UrlHelper {
|
|||
* - If the value is a well-formed (per RFC 3986) relative URL or
|
||||
* absolute URL that does not use a dangerous protocol (like
|
||||
* "javascript:"), then the URL remains unchanged. This includes all
|
||||
* URLs generated via Url::toString() and UrlGeneratorTrait::url().
|
||||
* URLs generated via Url::toString().
|
||||
* - If the value is a well-formed absolute URL with a dangerous protocol,
|
||||
* the protocol is stripped. This process is repeated on the remaining URL
|
||||
* until it is stripped down to a safe protocol.
|
||||
|
@ -347,7 +347,6 @@ class UrlHelper {
|
|||
*
|
||||
* @see \Drupal\Component\Utility\Html::escape()
|
||||
* @see \Drupal\Core\Url::toString()
|
||||
* @see \Drupal\Core\Routing\UrlGeneratorTrait::url()
|
||||
* @see \Drupal\Core\Url::fromUri()
|
||||
*/
|
||||
public static function stripDangerousProtocols($uri) {
|
||||
|
|
|
@ -4,9 +4,7 @@ namespace Drupal\Core\Controller;
|
|||
|
||||
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
|
||||
use Drupal\Core\Logger\LoggerChannelTrait;
|
||||
use Drupal\Core\Routing\LinkGeneratorTrait;
|
||||
use Drupal\Core\Routing\RedirectDestinationTrait;
|
||||
use Drupal\Core\Routing\UrlGeneratorTrait;
|
||||
use Drupal\Core\StringTranslation\StringTranslationTrait;
|
||||
use Drupal\Core\Url;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
@ -36,12 +34,10 @@ use Symfony\Component\HttpFoundation\RedirectResponse;
|
|||
*/
|
||||
abstract class ControllerBase implements ContainerInjectionInterface {
|
||||
|
||||
use LinkGeneratorTrait;
|
||||
use LoggerChannelTrait;
|
||||
use MessengerTrait;
|
||||
use RedirectDestinationTrait;
|
||||
use StringTranslationTrait;
|
||||
use UrlGeneratorTrait;
|
||||
|
||||
/**
|
||||
* The entity type manager.
|
||||
|
|
|
@ -12,7 +12,6 @@ use Drupal\Core\Link;
|
|||
use Drupal\Core\Render\RendererInterface;
|
||||
use Drupal\Core\Routing\RouteMatchInterface;
|
||||
use Drupal\Core\Routing\UrlGeneratorInterface;
|
||||
use Drupal\Core\Routing\UrlGeneratorTrait;
|
||||
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
|
||||
use Drupal\Core\StringTranslation\StringTranslationTrait;
|
||||
use Drupal\Core\StringTranslation\TranslationInterface;
|
||||
|
@ -34,7 +33,6 @@ use Symfony\Component\HttpFoundation\RedirectResponse;
|
|||
class EntityController implements ContainerInjectionInterface {
|
||||
|
||||
use StringTranslationTrait;
|
||||
use UrlGeneratorTrait;
|
||||
|
||||
/**
|
||||
* The entity type manager.
|
||||
|
|
|
@ -6,9 +6,7 @@ use Drupal\Core\Config\ConfigFactoryInterface;
|
|||
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
|
||||
use Drupal\Core\DependencyInjection\DependencySerializationTrait;
|
||||
use Drupal\Core\Logger\LoggerChannelTrait;
|
||||
use Drupal\Core\Routing\LinkGeneratorTrait;
|
||||
use Drupal\Core\Routing\RedirectDestinationTrait;
|
||||
use Drupal\Core\Routing\UrlGeneratorTrait;
|
||||
use Drupal\Core\StringTranslation\StringTranslationTrait;
|
||||
use Drupal\Core\Url;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
@ -46,12 +44,10 @@ use Drupal\Core\Messenger\MessengerTrait;
|
|||
abstract class FormBase implements FormInterface, ContainerInjectionInterface {
|
||||
|
||||
use DependencySerializationTrait;
|
||||
use LinkGeneratorTrait;
|
||||
use LoggerChannelTrait;
|
||||
use MessengerTrait;
|
||||
use RedirectDestinationTrait;
|
||||
use StringTranslationTrait;
|
||||
use UrlGeneratorTrait;
|
||||
|
||||
/**
|
||||
* The request stack.
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Core\Routing\Enhancer;
|
||||
|
||||
use Drupal\Core\Routing\EnhancerInterface;
|
||||
use Symfony\Component\Routing\Route;
|
||||
|
||||
@trigger_error('\Drupal\Core\Routing\Enhancer\RouteEnhancerInterface is deprecated in Drupal 8.5.0 and will be removed before Drupal 9.0.0. Instead, you should use \Drupal\Core\Routing\EnhancerInterface. See https://www.drupal.org/node/2894934', E_USER_DEPRECATED);
|
||||
|
||||
/**
|
||||
* A route enhance service to determine route enhance rules.
|
||||
*
|
||||
* @deprecated in drupal:8.4.0 and is removed from drupal:9.0.0. Instead,
|
||||
* you should use \Drupal\Core\Routing\EnhancerInterface.
|
||||
* See https://www.drupal.org/node/2894934
|
||||
* Part of the deprecation means that applies() is now called on runtime instead
|
||||
* of compile time.
|
||||
*/
|
||||
interface RouteEnhancerInterface extends EnhancerInterface {
|
||||
|
||||
/**
|
||||
* Declares if the route enhancer applies to the given route.
|
||||
*
|
||||
* @param \Symfony\Component\Routing\Route $route
|
||||
* The route to consider attaching to.
|
||||
*
|
||||
* @return bool
|
||||
* TRUE if the check applies to the passed route, False otherwise.
|
||||
*/
|
||||
public function applies(Route $route);
|
||||
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Core\Routing;
|
||||
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\Core\Utility\LinkGeneratorInterface;
|
||||
|
||||
/**
|
||||
* Wrapper methods for the Link Generator.
|
||||
*
|
||||
* This utility trait should only be used in application-level code, such as
|
||||
* classes that would implement ContainerInjectionInterface. Services registered
|
||||
* in the Container should not use this trait but inject the appropriate service
|
||||
* directly for easier testing.
|
||||
*
|
||||
* @deprecated in drupal:8.0.0 and is removed from drupal:9.0.0.
|
||||
* Use \Drupal\Core\Link instead.
|
||||
*
|
||||
* @see https://www.drupal.org/node/2614344
|
||||
*/
|
||||
trait LinkGeneratorTrait {
|
||||
|
||||
/**
|
||||
* The link generator.
|
||||
*
|
||||
* @var \Drupal\Core\Utility\LinkGeneratorInterface
|
||||
*/
|
||||
protected $linkGenerator;
|
||||
|
||||
/**
|
||||
* Renders a link to a route given a route name and its parameters.
|
||||
*
|
||||
* For details on the arguments, usage, and possible exceptions see
|
||||
* \Drupal\Core\Utility\LinkGeneratorInterface::generate().
|
||||
*
|
||||
* @return \Drupal\Core\GeneratedLink
|
||||
* A GeneratedLink object containing a link to the given route and
|
||||
* parameters and bubbleable metadata.
|
||||
*
|
||||
* @deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use
|
||||
* \Drupal\Core\Link::fromTextAndUrl() instead.
|
||||
*
|
||||
* @see https://www.drupal.org/node/2614344
|
||||
* @see \Drupal\Core\Utility\LinkGeneratorInterface::generate()
|
||||
*/
|
||||
protected function l($text, Url $url) {
|
||||
@trigger_error(__NAMESPACE__ . "\LinkGeneratorTrait::l() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Link::fromTextAndUrl() instead. See https://www.drupal.org/node/2614344", E_USER_DEPRECATED);
|
||||
return $this->getLinkGenerator()->generate($text, $url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the link generator.
|
||||
*
|
||||
* @return \Drupal\Core\Utility\LinkGeneratorInterface
|
||||
* The link generator
|
||||
*
|
||||
* @deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Inject the
|
||||
* 'link_generator' service or use \Drupal\Core\Link instead
|
||||
*
|
||||
* @see https://www.drupal.org/node/2614344
|
||||
*/
|
||||
protected function getLinkGenerator() {
|
||||
@trigger_error(__NAMESPACE__ . "\LinkGeneratorTrait::getLinkGenerator() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Inject the 'link_generator' service or use \Drupal\Core\Link instead. See https://www.drupal.org/node/2614344", E_USER_DEPRECATED);
|
||||
if (!isset($this->linkGenerator)) {
|
||||
$this->linkGenerator = \Drupal::service('link_generator');
|
||||
}
|
||||
return $this->linkGenerator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the link generator service.
|
||||
*
|
||||
* @param \Drupal\Core\Utility\LinkGeneratorInterface $generator
|
||||
* The link generator service.
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Inject the
|
||||
* 'link_generator' service or use \Drupal\Core\Link instead
|
||||
*
|
||||
* @see https://www.drupal.org/node/2614344
|
||||
*/
|
||||
public function setLinkGenerator(LinkGeneratorInterface $generator) {
|
||||
@trigger_error(__NAMESPACE__ . "\LinkGeneratorTrait::setLinkGenerator() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Inject the 'link_generator' service or use \Drupal\Core\Link instead. See https://www.drupal.org/node/2614344", E_USER_DEPRECATED);
|
||||
$this->linkGenerator = $generator;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Core\Routing;
|
||||
|
||||
use Symfony\Component\Routing\Route;
|
||||
|
||||
@trigger_error('\Drupal\Core\Routing\RouteFilterInterface is deprecated in Drupal 8.5.0 and will be removed before Drupal 9.0.0. Instead, you should use \Drupal\Core\Routing\FilterInterface. See https://www.drupal.org/node/2894934', E_USER_DEPRECATED);
|
||||
|
||||
/**
|
||||
* A route filter service to filter down the collection of route instances.
|
||||
*
|
||||
* @deprecated in drupal:8.4.0 and is removed from drupal:9.0.0. Instead,
|
||||
* you should use \Drupal\Core\Routing\FilterInterface.
|
||||
* See https://www.drupal.org/node/2894934
|
||||
*/
|
||||
interface RouteFilterInterface extends FilterInterface {
|
||||
|
||||
/**
|
||||
* Determines if the route filter applies to the given route.
|
||||
*
|
||||
* @param \Symfony\Component\Routing\Route $route
|
||||
* The route to consider attaching to.
|
||||
*
|
||||
* @return bool
|
||||
* TRUE if the check applies to the passed route, FALSE otherwise.
|
||||
*/
|
||||
public function applies(Route $route);
|
||||
|
||||
}
|
|
@ -3,9 +3,7 @@
|
|||
namespace Drupal\Core\Routing;
|
||||
|
||||
use Drupal\Core\Path\CurrentPathStack;
|
||||
use Drupal\Core\Routing\Enhancer\RouteEnhancerInterface;
|
||||
use Symfony\Cmf\Component\Routing\LazyRouteCollection;
|
||||
use Symfony\Cmf\Component\Routing\RouteObjectInterface;
|
||||
use Symfony\Cmf\Component\Routing\RouteProviderInterface as BaseRouteProviderInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
|
||||
|
@ -254,9 +252,6 @@ class Router extends UrlMatcher implements RequestMatcherInterface, RouterInterf
|
|||
*/
|
||||
protected function applyRouteEnhancers($defaults, Request $request) {
|
||||
foreach ($this->enhancers as $enhancer) {
|
||||
if ($enhancer instanceof RouteEnhancerInterface && !$enhancer->applies($defaults[RouteObjectInterface::ROUTE_OBJECT])) {
|
||||
continue;
|
||||
}
|
||||
$defaults = $enhancer->enhance($defaults, $request);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,106 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Core\Routing;
|
||||
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
|
||||
/**
|
||||
* Wrapper methods for the Url Generator.
|
||||
*
|
||||
* This utility trait should only be used in application-level code, such as
|
||||
* classes that would implement ContainerInjectionInterface. Services registered
|
||||
* in the Container should not use this trait but inject the appropriate service
|
||||
* directly for easier testing.
|
||||
*
|
||||
* @deprecated in drupal:8.0.0 and is removed from drupal:9.0.0.
|
||||
* Use \Drupal\Core\Url instead.
|
||||
*/
|
||||
trait UrlGeneratorTrait {
|
||||
|
||||
/**
|
||||
* The url generator.
|
||||
*
|
||||
* @var \Drupal\Core\Routing\UrlGeneratorInterface
|
||||
*/
|
||||
protected $urlGenerator;
|
||||
|
||||
/**
|
||||
* Generates a URL or path for a specific route based on the given parameters.
|
||||
*
|
||||
* For details on the arguments, usage, and possible exceptions see
|
||||
* \Drupal\Core\Routing\UrlGeneratorInterface::generateFromRoute().
|
||||
*
|
||||
* @return string
|
||||
* The generated URL for the given route.
|
||||
*
|
||||
* @deprecated in drupal:8.0.0 and is removed from drupal:9.0.0.
|
||||
* Use \Drupal\Core\Url::fromUri() instead.
|
||||
*
|
||||
* @see \Drupal\Core\Routing\UrlGeneratorInterface::generateFromRoute()
|
||||
*/
|
||||
protected function url($route_name, $route_parameters = [], $options = []) {
|
||||
@trigger_error(__NAMESPACE__ . "\UrlGeneratorTrait::url() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Url::fromUri() instead. See https://www.drupal.org/node/2614344", E_USER_DEPRECATED);
|
||||
return $this->getUrlGenerator()->generateFromRoute($route_name, $route_parameters, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a redirect response object for the specified route.
|
||||
*
|
||||
* @param string $route_name
|
||||
* The name of the route to which to redirect.
|
||||
* @param array $route_parameters
|
||||
* (optional) Parameters for the route.
|
||||
* @param array $options
|
||||
* (optional) An associative array of additional options.
|
||||
* @param int $status
|
||||
* (optional) The HTTP redirect status code for the redirect. The default is
|
||||
* 302 Found.
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse
|
||||
* A redirect response object that may be returned by the controller.
|
||||
*
|
||||
* @deprecated in drupal:8.0.0 and is removed from drupal:9.0.0.
|
||||
* Use new RedirectResponse(Url::fromRoute()) instead.
|
||||
*/
|
||||
protected function redirect($route_name, array $route_parameters = [], array $options = [], $status = 302) {
|
||||
@trigger_error(__NAMESPACE__ . "\UrlGeneratorTrait::redirect() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use new RedirectResponse(Url::fromRoute()) instead. See https://www.drupal.org/node/2614344", E_USER_DEPRECATED);
|
||||
$options['absolute'] = TRUE;
|
||||
$url = $this->getUrlGenerator()->generateFromRoute($route_name, $route_parameters, $options);
|
||||
return new RedirectResponse($url, $status);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the URL generator service.
|
||||
*
|
||||
* @return \Drupal\Core\Routing\UrlGeneratorInterface
|
||||
* The URL generator service.
|
||||
*
|
||||
* @deprecated in drupal:8.0.0 and is removed from drupal:9.0.0.
|
||||
* Use the url_generator service instead.
|
||||
*/
|
||||
protected function getUrlGenerator() {
|
||||
@trigger_error(__NAMESPACE__ . "\UrlGeneratorTrait::getUrlGenerator() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use the url_generator service instead. See https://www.drupal.org/node/2614344", E_USER_DEPRECATED);
|
||||
if (!$this->urlGenerator) {
|
||||
$this->urlGenerator = \Drupal::service('url_generator');
|
||||
}
|
||||
return $this->urlGenerator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the URL generator service.
|
||||
*
|
||||
* @param \Drupal\Core\Routing\UrlGeneratorInterface $generator
|
||||
* The url generator service.
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @deprecated in drupal:8.0.0 and is removed from drupal:9.0.0.
|
||||
*/
|
||||
public function setUrlGenerator(UrlGeneratorInterface $generator) {
|
||||
@trigger_error(__NAMESPACE__ . "\UrlGeneratorTrait::setUrlGenerator() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. See https://www.drupal.org/node/2614344", E_USER_DEPRECATED);
|
||||
$this->urlGenerator = $generator;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
|
@ -5,7 +5,6 @@ namespace Drupal\views\Plugin\views\display;
|
|||
use Drupal\Component\Utility\UrlHelper;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
use Drupal\Core\Routing\UrlGeneratorTrait;
|
||||
use Drupal\Core\State\StateInterface;
|
||||
use Drupal\Core\Routing\RouteCompiler;
|
||||
use Drupal\Core\Routing\RouteProviderInterface;
|
||||
|
@ -24,8 +23,6 @@ use Symfony\Component\Routing\RouteCollection;
|
|||
*/
|
||||
abstract class PathPluginBase extends DisplayPluginBase implements DisplayRouterInterface, DisplayMenuInterface {
|
||||
|
||||
use UrlGeneratorTrait;
|
||||
|
||||
/**
|
||||
* The route provider.
|
||||
*
|
||||
|
|
|
@ -6,7 +6,6 @@ use Drupal\Component\Utility\NestedArray;
|
|||
use Drupal\Core\Entity\EntityPublishedInterface;
|
||||
use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Routing\UrlGeneratorTrait;
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\views\Entity\View;
|
||||
use Drupal\views\Views;
|
||||
|
@ -37,8 +36,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
|||
*/
|
||||
abstract class WizardPluginBase extends PluginBase implements WizardInterface {
|
||||
|
||||
use UrlGeneratorTrait;
|
||||
|
||||
/**
|
||||
* The base table connected with the wizard.
|
||||
*
|
||||
|
|
|
@ -1,84 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\Core\Routing;
|
||||
|
||||
use Drupal\Tests\UnitTestCase;
|
||||
|
||||
/**
|
||||
* @coversDefaultClass \Drupal\Core\Routing\UrlGeneratorTrait
|
||||
* @group Routing
|
||||
* @group legacy
|
||||
*/
|
||||
class UrlGeneratorTraitTest extends UnitTestCase {
|
||||
|
||||
/**
|
||||
* @covers ::setUrlGenerator
|
||||
* @covers ::getUrlGenerator
|
||||
*
|
||||
* @expectedDeprecation Drupal\Core\Routing\UrlGeneratorTrait::setUrlGenerator() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. See https://www.drupal.org/node/2614344
|
||||
* @expectedDeprecation Drupal\Core\Routing\UrlGeneratorTrait::getUrlGenerator() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use the url_generator service instead. See https://www.drupal.org/node/2614344
|
||||
*/
|
||||
public function testGetUrlGenerator() {
|
||||
$url_generator = $this->createMock('Drupal\Core\Routing\UrlGeneratorInterface');
|
||||
|
||||
$url_generator_trait_object = $this->getMockForTrait('Drupal\Core\Routing\UrlGeneratorTrait');
|
||||
$url_generator_trait_object->setUrlGenerator($url_generator);
|
||||
|
||||
$url_generator_method = new \ReflectionMethod($url_generator_trait_object, 'getUrlGenerator');
|
||||
$url_generator_method->setAccessible(TRUE);
|
||||
$result = $url_generator_method->invoke($url_generator_trait_object);
|
||||
$this->assertEquals($url_generator, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::redirect
|
||||
*
|
||||
* @expectedDeprecation Drupal\Core\Routing\UrlGeneratorTrait::redirect() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use new RedirectResponse(Url::fromRoute()) instead. See https://www.drupal.org/node/2614344
|
||||
*/
|
||||
public function testRedirect() {
|
||||
$route_name = 'some_route_name';
|
||||
$generated_url = 'some/generated/url';
|
||||
|
||||
$url_generator = $this->createMock('Drupal\Core\Routing\UrlGeneratorInterface');
|
||||
$url_generator->expects($this->once())
|
||||
->method('generateFromRoute')
|
||||
->with($route_name, [], ['absolute' => TRUE])
|
||||
->willReturn($generated_url);
|
||||
|
||||
$url_generator_trait_object = $this->getMockForTrait('Drupal\Core\Routing\UrlGeneratorTrait');
|
||||
$url_generator_trait_object->setUrlGenerator($url_generator);
|
||||
|
||||
$url_generator_method = new \ReflectionMethod($url_generator_trait_object, 'redirect');
|
||||
$url_generator_method->setAccessible(TRUE);
|
||||
|
||||
$result = $url_generator_method->invoke($url_generator_trait_object, $route_name);
|
||||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\RedirectResponse', $result);
|
||||
$this->assertSame($generated_url, $result->getTargetUrl());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::url
|
||||
*
|
||||
* @expectedDeprecation Drupal\Core\Routing\UrlGeneratorTrait::url() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Url::fromUri() instead. See https://www.drupal.org/node/2614344
|
||||
*/
|
||||
public function testUrl() {
|
||||
$route_name = 'some_route_name';
|
||||
$generated_url = 'some/generated/url';
|
||||
|
||||
$url_generator = $this->createMock('Drupal\Core\Routing\UrlGeneratorInterface');
|
||||
$url_generator->expects($this->once())
|
||||
->method('generateFromRoute')
|
||||
->with($route_name, [], [])
|
||||
->willReturn($generated_url);
|
||||
|
||||
$url_generator_trait_object = $this->getMockForTrait('Drupal\Core\Routing\UrlGeneratorTrait');
|
||||
$url_generator_trait_object->setUrlGenerator($url_generator);
|
||||
|
||||
$url_generator_method = new \ReflectionMethod($url_generator_trait_object, 'url');
|
||||
$url_generator_method->setAccessible(TRUE);
|
||||
|
||||
$result = $url_generator_method->invoke($url_generator_trait_object, $route_name);
|
||||
$this->assertSame($generated_url, $result);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue