function LocalTasksTest::assertLocalTaskAppears

Same name in other branches
  1. 8.9.x core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php \Drupal\Tests\system\Functional\Menu\LocalTasksTest::assertLocalTaskAppears()
  2. 10 core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php \Drupal\Tests\system\Functional\Menu\LocalTasksTest::assertLocalTaskAppears()
  3. 11.x 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>@');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.