function LocalTasksTest::assertLocalTaskAppears

Same name and namespace in other branches
  1. 9 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.

Parameters

string $title: The expected title.

Return value

bool TRUE if the local task exists on the page.

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 76

Class

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

Namespace

Drupal\Tests\system\Functional\Menu

Code

protected function assertLocalTaskAppears($title) {
    // 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.
    return $this->assertPattern('@<a [^>]*>' . preg_quote($title, '@') . '</a>@');
}

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