You are here

protected function SearchIntegrationTest::assertOneLink in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Tests/SearchIntegrationTest.php \Drupal\views\Tests\SearchIntegrationTest::assertOneLink()

Asserts that exactly one link exists with the given text.

Parameters

string $label: Link label to assert.

Return value

bool TRUE if the assertion succeeded, FALSE otherwise.

1 call to SearchIntegrationTest::assertOneLink()
SearchIntegrationTest::testSearchIntegration in core/modules/views/src/Tests/SearchIntegrationTest.php
Tests search integration.

File

core/modules/views/src/Tests/SearchIntegrationTest.php, line 148
Contains \Drupal\views\Tests\SearchIntegrationTest.

Class

SearchIntegrationTest
Tests search integration filters.

Namespace

Drupal\views\Tests

Code

protected function assertOneLink($label) {
  $links = $this
    ->xpath('//a[normalize-space(text())=:label]', array(
    ':label' => $label,
  ));
  $message = SafeMarkup::format('Link with label %label found once.', array(
    '%label' => $label,
  ));
  return $this
    ->assert(isset($links[0]) && !isset($links[1]), $message);
}