You are here

protected function WebTestBase::findBlockInstance in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/simpletest/src/WebTestBase.php \Drupal\simpletest\WebTestBase::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 WebTestBase::findBlockInstance()
WebTestBase::assertBlockAppears in core/modules/simpletest/src/WebTestBase.php
Checks to see whether a block appears on the page.
WebTestBase::assertNoBlockAppears in core/modules/simpletest/src/WebTestBase.php
Checks to see whether a block does not appears on the page.

File

core/modules/simpletest/src/WebTestBase.php, line 476
Contains \Drupal\simpletest\WebTestBase.

Class

WebTestBase
Test case for typical Drupal tests.

Namespace

Drupal\simpletest

Code

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