You are here

protected function SearchIntegrationTest::assertOneLink in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/tests/src/Functional/SearchIntegrationTest.php \Drupal\Tests\views\Functional\SearchIntegrationTest::assertOneLink()
  2. 10 core/modules/views/tests/src/Functional/SearchIntegrationTest.php \Drupal\Tests\views\Functional\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.

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

File

core/modules/views/tests/src/Functional/SearchIntegrationTest.php, line 150

Class

SearchIntegrationTest
Tests search integration filters.

Namespace

Drupal\Tests\views\Functional

Code

protected function assertOneLink($label) {
  $xpath = $this
    ->assertSession()
    ->buildXPathQuery('//a[normalize-space(text())=:label]', [
    ':label' => $label,
  ]);
  $this
    ->assertSession()
    ->elementsCount('xpath', $xpath, 1);
  return TRUE;
}