You are here

protected function InlineBlockTestBase::addInlineBlockToLayout in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTestBase.php \Drupal\Tests\layout_builder\FunctionalJavascript\InlineBlockTestBase::addInlineBlockToLayout()

Adds an entity block to the layout.

Parameters

string $title: The title field value.

string $body: The body field value.

6 calls to InlineBlockTestBase::addInlineBlockToLayout()
InlineBlockTest::testAccess in core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php
Tests access to the block edit form of inline blocks.
InlineBlockTest::testDeletion in core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php
Tests that entity blocks deleted correctly.
InlineBlockTest::testEditInlineBlocksPermission in core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php
Tests 'create and edit custom blocks' permission to edit an existing block.
InlineBlockTest::testInlineBlocks in core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php
Tests adding and editing of inline blocks.
InlineBlockTest::testInlineBlocksRevisioning in core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php
Tests entity blocks revisioning.

... See full list

File

core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTestBase.php, line 133

Class

InlineBlockTestBase
Base class for testing inline blocks.

Namespace

Drupal\Tests\layout_builder\FunctionalJavascript

Code

protected function addInlineBlockToLayout($title, $body) {
  $assert_session = $this
    ->assertSession();
  $page = $this
    ->getSession()
    ->getPage();
  $page
    ->clickLink('Add block');
  $assert_session
    ->assertWaitOnAjaxRequest();
  $this
    ->assertNotEmpty($assert_session
    ->waitForLink('Create custom block'));
  $this
    ->clickLink('Create custom block');
  $assert_session
    ->assertWaitOnAjaxRequest();
  $textarea = $assert_session
    ->waitForElement('css', '[name="settings[block_form][body][0][value]"]');
  $this
    ->assertNotEmpty($textarea);
  $assert_session
    ->fieldValueEquals('Title', '');
  $page
    ->findField('Title')
    ->setValue($title);
  $textarea
    ->setValue($body);
  $page
    ->pressButton('Add block');
  $this
    ->assertDialogClosedAndTextVisible($body, static::INLINE_BLOCK_LOCATOR);
}