function LayoutBuilderContentModerationIntegrationTest::testModeratedInlineBlockBundles
Same name in other branches
- 10 core/modules/content_moderation/tests/src/Functional/LayoutBuilderContentModerationIntegrationTest.php \Drupal\Tests\content_moderation\Functional\LayoutBuilderContentModerationIntegrationTest::testModeratedInlineBlockBundles()
- 11.x core/modules/content_moderation/tests/src/Functional/LayoutBuilderContentModerationIntegrationTest.php \Drupal\Tests\content_moderation\Functional\LayoutBuilderContentModerationIntegrationTest::testModeratedInlineBlockBundles()
Test placing inline blocks that belong to a moderated custom block bundle.
File
-
core/
modules/ content_moderation/ tests/ src/ Functional/ LayoutBuilderContentModerationIntegrationTest.php, line 158
Class
- LayoutBuilderContentModerationIntegrationTest
- Tests Content Moderation's integration with Layout Builder.
Namespace
Drupal\Tests\content_moderation\FunctionalCode
public function testModeratedInlineBlockBundles() {
$page = $this->getSession()
->getPage();
$assert_session = $this->assertSession();
$node = $this->createNode([
'type' => 'bundle_with_section_field',
'title' => 'The first node title',
'moderation_state' => 'published',
]);
$this->drupalGet("node/{$node->id()}/layout");
$page->clickLink('Add block');
$this->clickLink('Create custom block');
$assert_session->fieldNotExists('settings[block_form][moderation_state][0][state]');
$this->submitForm([
'settings[label]' => 'Test inline block',
'settings[block_form][body][0][value]' => 'Example block body',
], 'Add block');
// Save a draft of the page with the inline block and ensure the drafted
// content appears on the latest version page.
$this->assertSession()
->pageTextContains('Example block body');
$this->submitForm([
'moderation_state[0][state]' => 'draft',
], 'Save layout');
$assert_session->pageTextContains('The layout override has been saved.');
$assert_session->pageTextContains('Example block body');
// Publish the draft of the page ensure the draft inline block content
// appears on the published page.
$this->submitForm([
'new_state' => 'published',
], 'Apply');
$assert_session->pageTextContains('The moderation state has been updated.');
$assert_session->pageTextContains('Example block body');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.