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