You are here

protected function AssertBlockAppearsTrait::findBlockInstance in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/block/tests/src/Functional/AssertBlockAppearsTrait.php \Drupal\Tests\block\Functional\AssertBlockAppearsTrait::findBlockInstance()

Find a block instance on the page.

Parameters

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

Return value

array The result from the xpath query.

2 calls to AssertBlockAppearsTrait::findBlockInstance()
AssertBlockAppearsTrait::assertBlockAppears in core/modules/block/tests/src/Functional/AssertBlockAppearsTrait.php
Checks to see whether a block appears on the page.
AssertBlockAppearsTrait::assertNoBlockAppears in core/modules/block/tests/src/Functional/AssertBlockAppearsTrait.php
Checks to see whether a block does not appears on the page.

File

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

Class

AssertBlockAppearsTrait
Provides test assertions for testing block appearance.

Namespace

Drupal\Tests\block\Functional

Code

protected function findBlockInstance(Block $block) {
  return $this
    ->xpath('//div[@id = :id]', [
    ':id' => 'block-' . $block
      ->id(),
  ]);
}