You are here

public function UrlGeneratorTraitTest::testGetUrlGenerator in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTraitTest.php \Drupal\Tests\Core\Routing\UrlGeneratorTraitTest::testGetUrlGenerator()

@covers ::setUrlGenerator @covers ::getUrlGenerator

File

core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTraitTest.php, line 22
Contains \Drupal\Tests\Core\Routing\UrlGeneratorTraitTest.

Class

UrlGeneratorTraitTest
@coversDefaultClass \Drupal\Core\Routing\UrlGeneratorTrait @group Routing

Namespace

Drupal\Tests\Core\Routing

Code

public function testGetUrlGenerator() {
  $url_generator = $this
    ->getMock('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);
}