You are here

public function LayoutBuilderTest::testBlockUiListing in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderTest::testBlockUiListing()
  2. 10 core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderTest::testBlockUiListing()

Tests the Block UI when Layout Builder is installed.

File

core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php, line 1116

Class

LayoutBuilderTest
Tests the Layout Builder UI.

Namespace

Drupal\Tests\layout_builder\Functional

Code

public function testBlockUiListing() {
  $assert_session = $this
    ->assertSession();
  $page = $this
    ->getSession()
    ->getPage();
  $this
    ->drupalLogin($this
    ->drupalCreateUser([
    'administer blocks',
  ]));
  $this
    ->drupalGet('admin/structure/block');
  $page
    ->clickLink('Place block');

  // Ensure that blocks expected to appear are available.
  $assert_session
    ->pageTextContains('Test HTML block');
  $assert_session
    ->pageTextContains('Block test');

  // Ensure that blocks not expected to appear are not available.
  $assert_session
    ->pageTextNotContains('Body');
  $assert_session
    ->pageTextNotContains('Content fields');
}