You are here

public function BlockUiTest::testContextAwareUnsatisfiedBlocks in Drupal 10

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

Tests the behavior of unsatisfied context-aware blocks.

File

core/modules/block/tests/src/Functional/BlockUiTest.php, line 205

Class

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

Namespace

Drupal\Tests\block\Functional

Code

public function testContextAwareUnsatisfiedBlocks() {
  $this
    ->drupalGet('admin/structure/block');
  $this
    ->clickLink('Place block');

  // Verify that the context-aware test block does not appear.
  $this
    ->assertSession()
    ->elementNotExists('xpath', '//tr[.//td/div[text()="Test context-aware unsatisfied block"] and .//td[text()="Block test"] and .//td//a[contains(@href, "admin/structure/block/add/test_context_aware_unsatisfied/stark")]]');
  $definition = \Drupal::service('plugin.manager.block')
    ->getDefinition('test_context_aware_unsatisfied');
  $this
    ->assertNotEmpty($definition, 'The context-aware test block does not exist.');
}