You are here

protected function LocalTasksTest::assertNoLocalTasks in Drupal 9

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

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
Tests 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.');
}