public function LayoutBuilderQuickEditTest::testEnableDisableLayoutBuilder in Drupal 9
Tests Quick Edit boots correctly with Layout Builder defaults & overrides.
@dataProvider providerEnableDisableLayoutBuilder
Parameters
bool $use_revisions: If revisions are used.
File
- core/
modules/ quickedit/ tests/ src/ FunctionalJavascript/ LayoutBuilderQuickEditTest.php, line 126
Class
- LayoutBuilderQuickEditTest
- Tests that Layout Builder functions with Quick Edit.
Namespace
Drupal\Tests\quickedit\FunctionalJavascriptCode
public function testEnableDisableLayoutBuilder($use_revisions) {
if (!$use_revisions) {
$content_type = NodeType::load('article');
$content_type
->setNewRevision(FALSE);
$content_type
->save();
}
$fields = [
'title',
'uid',
'created',
'body',
];
// Test article with Layout Builder disabled.
$this
->assertQuickEditInit($fields);
// Test article with Layout Builder enabled.
$this
->enableLayouts('admin/structure/types/manage/article/display/default');
$this->usingLayoutBuilder = TRUE;
$this
->assertQuickEditInit($fields);
// Test article with Layout Builder override.
$this
->createLayoutOverride();
$this
->assertQuickEditInit($fields);
// If we're using revisions, it's not possible to disable Layout Builder
// without deleting the node (unless the revisions containing the override
// would be deleted).
if (!$use_revisions) {
// Test article with Layout Builder when reverted back to defaults.
$this
->revertLayoutToDefaults();
$this
->assertQuickEditInit($fields);
// Test with Layout Builder disabled after being enabled.
$this->usingLayoutBuilder = FALSE;
$this
->disableLayoutBuilder('admin/structure/types/manage/article/display/default');
$this
->assertQuickEditInit($fields);
}
}