function InlineBlockTest::testAddInlineBlocksPermission
Same name in other branches
- 9 core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\InlineBlockTest::testAddInlineBlocksPermission()
- 8.9.x core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\InlineBlockTest::testAddInlineBlocksPermission()
- 11.x core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\InlineBlockTest::testAddInlineBlocksPermission()
Tests the 'create and edit content blocks' permission to add a new block.
File
-
core/
modules/ layout_builder/ tests/ src/ FunctionalJavascript/ InlineBlockTest.php, line 600
Class
- InlineBlockTest
- Tests that the inline block feature works correctly.
Namespace
Drupal\Tests\layout_builder\FunctionalJavascriptCode
public function testAddInlineBlocksPermission() : void {
LayoutBuilderEntityViewDisplay::load('node.bundle_with_section_field.default')->enableLayoutBuilder()
->setOverridable()
->save();
$assert = function ($permissions, $expected) {
$assert_session = $this->assertSession();
$page = $this->getSession()
->getPage();
$this->drupalLogin($this->drupalCreateUser($permissions));
$this->drupalGet(static::FIELD_UI_PREFIX . '/display/default/layout');
$page->clickLink('Add block');
$this->assertNotEmpty($assert_session->waitForElementVisible('css', '#drupal-off-canvas .block-categories'));
if ($expected) {
$assert_session->linkExists('Create content block');
}
else {
$assert_session->linkNotExists('Create content block');
}
};
$permissions = [
'configure any layout',
'administer node display',
];
$assert($permissions, FALSE);
$permissions[] = 'create and edit custom blocks';
$assert($permissions, TRUE);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.