You are here

public function BlockUiTest::testContextAwareUnsatisfiedBlocks in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/block/src/Tests/BlockUiTest.php \Drupal\block\Tests\BlockUiTest::testContextAwareUnsatisfiedBlocks()

Tests the behavior of unsatisfied context-aware blocks.

File

core/modules/block/src/Tests/BlockUiTest.php, line 197
Contains \Drupal\block\Tests\BlockUiTest.

Class

BlockUiTest
Tests that the block configuration UI exists and stores data correctly.

Namespace

Drupal\block\Tests

Code

public function testContextAwareUnsatisfiedBlocks() {
  $arguments = array(
    ':category' => 'Block test',
    ':href' => 'admin/structure/block/add/test_context_aware_unsatisfied/classy',
    ':text' => 'Test context-aware unsatisfied block',
  );
  $this
    ->drupalGet('admin/structure/block');
  $this
    ->clickLinkPartialName('Place block');
  $elements = $this
    ->xpath('//tr[.//td/div[text()=:text] and .//td[text()=:category] and .//td//a[contains(@href, :href)]]', $arguments);
  $this
    ->assertTrue(empty($elements), 'The context-aware test block does not appear.');
  $definition = \Drupal::service('plugin.manager.block')
    ->getDefinition('test_context_aware_unsatisfied');
  $this
    ->assertTrue(!empty($definition), 'The context-aware test block does not exist.');
}