function LocalTasksTest::assertNoLocalTasks

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php \Drupal\Tests\system\Functional\Menu\LocalTasksTest::assertNoLocalTasks()
  2. 10 core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php \Drupal\Tests\system\Functional\Menu\LocalTasksTest::assertNoLocalTasks()
  3. 11.x core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php \Drupal\Tests\system\Functional\Menu\LocalTasksTest::assertNoLocalTasks()

Asserts that the local tasks on the specified level are not being printed.

Parameters

int $level: (optional) The local tasks level to assert; 0 for primary, 1 for secondary. Defaults to 0.

2 calls to LocalTasksTest::assertNoLocalTasks()
LocalTasksTest::testLocalTaskBlock in core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php
Tests that local task blocks are configurable to show a specific level.
LocalTasksTest::testLocalTaskBlockCache in core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php
Test that local tasks blocks cache is invalidated correctly.

File

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

Class

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

Namespace

Drupal\Tests\system\Functional\Menu

Code

protected function assertNoLocalTasks($level = 0) {
    $elements = $this->xpath('//*[contains(@class, :class)]//a', [
        ':class' => $level == 0 ? 'tabs primary' : 'tabs secondary',
    ]);
    $this->assertEmpty($elements, 'Local tasks not found.');
}

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