function LocalTasksTest::assertNoLocalTasks

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

@internal

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 95

Class

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

Namespace

Drupal\Tests\system\Functional\Menu

Code

protected function assertNoLocalTasks(int $level = 0) : void {
    $this->assertSession()
        ->elementNotExists('xpath', '//*[contains(@class, "' . ($level == 0 ? 'tabs primary' : 'tabs secondary') . '")]//a');
}

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