public function LinkGeneratorTest::testGenerateQuery in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php \Drupal\Tests\Core\Utility\LinkGeneratorTest::testGenerateQuery()
Tests the link method with passed query options.
See also
\Drupal\Core\Utility\LinkGenerator::generate()
File
- core/
tests/ Drupal/ Tests/ Core/ Utility/ LinkGeneratorTest.php, line 252 - Contains \Drupal\Tests\Core\Utility\LinkGeneratorTest.
Class
- LinkGeneratorTest
- @coversDefaultClass \Drupal\Core\Utility\LinkGenerator @group Utility
Namespace
Drupal\Tests\Core\UtilityCode
public function testGenerateQuery() {
$this->urlGenerator
->expects($this
->once())
->method('generateFromRoute')
->with('test_route_1', array(), array(
'query' => array(
'test' => 'value',
),
) + $this->defaultOptions)
->willReturn((new GeneratedUrl())
->setGeneratedUrl('/test-route-1?test=value'));
$url = new Url('test_route_1', array(), array(
'query' => array(
'test' => 'value',
),
));
$url
->setUrlGenerator($this->urlGenerator);
$result = $this->linkGenerator
->generate('Test', $url);
$this
->assertLink(array(
'attributes' => array(
'href' => '/test-route-1?test=value',
),
), $result);
}