Commit 8e6b32a9 authored by alexpott's avatar alexpott

Issue #2315555 by undertext, larowlan: Fixed...

Issue #2315555 by undertext, larowlan: Fixed UrlGeneratorTrait::setUrlGenerator sets linkGenerator property instead of urlGenerator.
parent 65cb382c
<?php
/**
* @file Contains Drupal\Core\Routing\LinkGeneratorTrait.
* @file
* Contains Drupal\Core\Routing\UrlGeneratorTrait.
*/
namespace Drupal\Core\Routing;
use Drupal\Core\Utility\LinkGeneratorInterface;
use Drupal\Core\Routing\UrlGeneratorInterface;
/**
* Wrapper methods for the Url Generator.
*
......@@ -62,7 +59,7 @@ protected function getUrlGenerator() {
* @return $this
*/
public function setUrlGenerator(UrlGeneratorInterface $generator) {
$this->linkGenerator = $generator;
$this->urlGenerator = $generator;
return $this;
}
......
<?php
/**
* @file
* Contains Drupal\Tests\Core\Routing\UrlGeneratorTraitTest.
*/
namespace Drupal\Tests\Core\Routing;
use Drupal\Tests\UnitTestCase;
/**
* @coversDefaultClass \Drupal\Core\Routing\UrlGeneratorTrait
* @group Routing
*/
class UrlGeneratorTraitTest extends UnitTestCase {
/**
* @covers ::setUrlGenerator
* @covers ::getUrlGenerator
*/
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);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment