You are here

public function ViewsBaseUrlFieldTest::testViewsBaseUrlNoLink in Views base url 8

Same name and namespace in other branches
  1. 2.0.x tests/src/Functional/ViewsBaseUrlFieldTest.php \Drupal\Tests\views_base_url\Functional\ViewsBaseUrlFieldTest::testViewsBaseUrlNoLink()

Tests views base url field when `show_link` is disabled.

File

tests/src/Functional/ViewsBaseUrlFieldTest.php, line 140

Class

ViewsBaseUrlFieldTest
Basic test for views base url.

Namespace

Drupal\Tests\views_base_url\Functional

Code

public function testViewsBaseUrlNoLink() {
  global $base_url;
  $this
    ->drupalGet('views-base-url-nolink-test');
  $this
    ->assertResponse(200);
  $elements = $this
    ->xpath('//div[contains(@class,"view-views-base-url-no-link-test")]/div[@class="view-content"]/div[contains(@class,"views-row")]');
  $this
    ->assertEqual(count($elements), $this->nodeCount, t('There are @count rows', [
    '@count' => $this->nodeCount,
  ]));
  $elements = $this
    ->xpath('//div[contains(@class,"views-field-base-url")]/span[@class="field-content" and text()=:value]', [
    ':value' => $base_url,
  ]);
  $this
    ->assertEqual(count($elements), $this->nodeCount, t('Base url is displayed @count times', [
    '@count' => $this->nodeCount,
  ]));
}