You are here

protected function SearchIntegrationTest::assertOneLink in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views/tests/src/Functional/SearchIntegrationTest.php \Drupal\Tests\views\Functional\SearchIntegrationTest::assertOneLink()
  2. 9 core/modules/views/tests/src/Functional/SearchIntegrationTest.php \Drupal\Tests\views\Functional\SearchIntegrationTest::assertOneLink()

Asserts that exactly one link exists with the given text.

@internal

Parameters

string $label: Link label to assert.

File

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

Class

SearchIntegrationTest
Tests search integration filters.

Namespace

Drupal\Tests\views\Functional

Code

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