function AssertBlockAppearsTrait::assertNoBlockAppears

Same name in other branches
  1. 9 core/modules/block/tests/src/Functional/AssertBlockAppearsTrait.php \Drupal\Tests\block\Functional\AssertBlockAppearsTrait::assertNoBlockAppears()
  2. 10 core/modules/block/tests/src/Functional/AssertBlockAppearsTrait.php \Drupal\Tests\block\Functional\AssertBlockAppearsTrait::assertNoBlockAppears()
  3. 11.x core/modules/block/tests/src/Functional/AssertBlockAppearsTrait.php \Drupal\Tests\block\Functional\AssertBlockAppearsTrait::assertNoBlockAppears()

Checks to see whether a block does not appears on the page.

Parameters

\Drupal\block\Entity\Block $block: The block entity to find on the page.

2 calls to AssertBlockAppearsTrait::assertNoBlockAppears()
DisplayBlockTest::testDeleteBlockDisplay in core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php
Tests removing a block display.
ShortcutLinksTest::testShortcutBlockAccess in core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php
Tests that the 'access shortcuts' permission is required to access the shortcut block.

File

core/modules/block/tests/src/Functional/AssertBlockAppearsTrait.php, line 32

Class

AssertBlockAppearsTrait
Provides test assertions for testing block appearance.

Namespace

Drupal\Tests\block\Functional

Code

protected function assertNoBlockAppears(Block $block) {
    $result = $this->findBlockInstance($block);
    $this->assertFalse(!empty($result), new FormattableMarkup('The block @id does not appear on the page', [
        '@id' => $block->id(),
    ]));
}

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