protected function ViewTestBase::findBlockInstance

Find a block instance on the page.

Parameters

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

Return value

array The result from the xpath query.

2 calls to ViewTestBase::findBlockInstance()
ViewTestBase::assertBlockAppears in drupal/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.php
Checks to see whether a block appears on the page.
ViewTestBase::assertNoBlockAppears in drupal/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.php
Checks to see whether a block does not appears on the page.

File

drupal/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.php, line 265
Contains \Drupal\views\Tests\ViewTestBase.

Class

ViewTestBase
Defines a base class for Views testing in the full web test environment.

Namespace

Drupal\views\Tests

Code

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