public function ViewsBaseUrlFieldTest::testViewsBaseUrlLinkLinkQuery in Views base url 2.0.x
Same name and namespace in other branches
- 8 tests/src/Functional/ViewsBaseUrlFieldTest.php \Drupal\Tests\views_base_url\Functional\ViewsBaseUrlFieldTest::testViewsBaseUrlLinkLinkQuery()
Tests views base url field when `show_link` enabled and `link_query` set.
File
- tests/
src/ Functional/ ViewsBaseUrlFieldTest.php, line 284
Class
- ViewsBaseUrlFieldTest
- Basic test for views base url.
Namespace
Drupal\Tests\views_base_url\FunctionalCode
public function testViewsBaseUrlLinkLinkQuery() {
global $base_url;
$this
->drupalGet('views-base-url-link-link-query-test');
$this
->assertResponse(200);
$elements = $this
->xpath('//div[contains(@class,"view-views-base-url-link-link-query-test")]/div[@class="view-content"]/div[contains(@class,"views-row")]');
$this
->assertEqual(count($elements), $this->nodeCount, t('There are @count rows', [
'@count' => $this->nodeCount,
]));
$link_path = $base_url;
$link_text = $link_path;
$elements = $this
->xpath('//a[@href=:path and text()=:text]', [
':path' => Url::fromUri($link_path, [
'query' => [
'destination' => 'node',
],
])
->toUriString(),
':text' => $link_text,
]);
$this
->assertEqual(count($elements), $this->nodeCount, 'Views base url rendered as link with link query set');
}