function LayoutBuilderBlocksTest::testBlockUiListing

Same name in other branches
  1. 11.x core/modules/layout_builder/tests/src/Functional/LayoutBuilderBlocksTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderBlocksTest::testBlockUiListing()

Tests the Block UI when Layout Builder is installed.

File

core/modules/layout_builder/tests/src/Functional/LayoutBuilderBlocksTest.php, line 267

Class

LayoutBuilderBlocksTest
Tests the Layout Builder UI with blocks.

Namespace

Drupal\Tests\layout_builder\Functional

Code

public function testBlockUiListing() : void {
    $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.