X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Flayout_builder%2Ftests%2Fsrc%2FFunctionalJavascript%2FInlineBlockTestBase.php;h=2b781766a03812ace2b4f649f2a9236788438734;hb=1c1cb0980bfa6caf0c24cce671b6bb541dc87583;hp=6c99c6c39f107068d21fe5d46edf3d581d58e781;hpb=9424afc6c1f518c301bf87a23c047d1873435d05;p=yaffs-website diff --git a/web/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTestBase.php b/web/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTestBase.php index 6c99c6c39..2b781766a 100644 --- a/web/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTestBase.php +++ b/web/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTestBase.php @@ -71,13 +71,7 @@ abstract class InlineBlockTestBase extends WebDriverTestBase { ], ], ]); - $bundle = BlockContentType::create([ - 'id' => 'basic', - 'label' => 'Basic block', - 'revision' => 1, - ]); - $bundle->save(); - block_content_add_body_field($bundle->id()); + $this->createBlockContentType('basic', 'Basic block'); $this->blockStorage = $this->container->get('entity_type.manager')->getStorage('block_content'); } @@ -146,8 +140,8 @@ abstract class InlineBlockTestBase extends WebDriverTestBase { $page = $this->getSession()->getPage(); $page->clickLink('Add Block'); $assert_session->assertWaitOnAjaxRequest(); - $this->assertNotEmpty($assert_session->waitForElementVisible('css', '.block-categories details:contains(Create new block)')); - $this->clickLink('Basic block'); + $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); @@ -219,4 +213,22 @@ abstract class InlineBlockTestBase extends WebDriverTestBase { } } + /** + * Creates a block content type. + * + * @param string $id + * The block type id. + * @param string $label + * The block type label. + */ + protected function createBlockContentType($id, $label) { + $bundle = BlockContentType::create([ + 'id' => $id, + 'label' => $label, + 'revision' => 1, + ]); + $bundle->save(); + block_content_add_body_field($bundle->id()); + } + }