You are here

protected function LocalTasksTest::assertLocalTaskAppears in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php \Drupal\Tests\system\Functional\Menu\LocalTasksTest::assertLocalTaskAppears()
  2. 9 core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php \Drupal\Tests\system\Functional\Menu\LocalTasksTest::assertLocalTaskAppears()

Ensures that some local task appears.

@internal

Parameters

string $title: The expected title.

1 call to LocalTasksTest::assertLocalTaskAppears()
LocalTasksTest::testPluginLocalTask in core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php
Tests the plugin based local tasks.

File

core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php, line 78

Class

LocalTasksTest
Tests local tasks derived from router and added/altered via hooks.

Namespace

Drupal\Tests\system\Functional\Menu

Code

protected function assertLocalTaskAppears(string $title) : void {

  // SimpleXML gives us the unescaped text, not the actual escaped markup,
  // so use a pattern instead to check the raw content.
  // This behavior is a bug in libxml, see
  // https://bugs.php.net/bug.php?id=49437.
  $this
    ->assertSession()
    ->responseMatches('@<a [^>]*>' . preg_quote($title, '@') . '</a>@');
}