Commit 5c472869 authored by Liam Morland's avatar Liam Morland
Browse files

ISTWCMS-4705: Test layout_builder_lock

parent 26097106
......@@ -432,6 +432,42 @@ class UwWcmsBasicTest extends BrowserTestBase {
// No access to delete page.
$this->drupalGet('node/' . $content_nids['uw_ct_web_page'] . '/delete');
$this->assertSession()->statusCodeEquals(403);
// Test that admin has access to all Layout Builder configuration paths
// and site manager has access to only some paths.
$layout_builder_lock_test_users = [
'administrator',
'uw_role_site_manager',
];
$layout_builder_lock_test_content_types = [
'uw_ct_blog',
'uw_ct_event',
'uw_ct_news_item',
];
foreach ($layout_builder_lock_test_users as $user) {
$this->drupalLogin($this->drupalUsers[$user]);
foreach ($layout_builder_lock_test_content_types as $content_type) {
$nid = $content_nids[$content_type];
$this->drupalGet('node/' . $nid . '/layout');
$paths = [
'layout_builder/choose/section/overrides/node.' . $nid . '/0' => FALSE,
'layout_builder/choose/section/overrides/node.' . $nid . '/1' => TRUE,
'layout_builder/choose/section/overrides/node.' . $nid . '/2' => TRUE,
'layout_builder/choose/section/overrides/node.' . $nid . '/3' => FALSE,
'layout_builder/configure/section/overrides/node.' . $nid . '/0' => FALSE,
'layout_builder/configure/section/overrides/node.' . $nid . '/1' => TRUE,
'layout_builder/configure/section/overrides/node.' . $nid . '/2' => FALSE,
];
foreach ($paths as $path => $access) {
if ($access || $user === 'administrator') {
$this->assertSession()->linkByHrefExists($path);
}
else {
$this->assertSession()->linkByHrefNotExists($path);
}
}
}
}
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment