function LayoutBuilderTest::testBlockUiListing

Same name and namespace in other branches
  1. 8.9.x 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 1346

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');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.