Commit 428d2bcd authored by Liam Morland's avatar Liam Morland
Browse files

ISTWCMS-3968: Test Webform path access

parent 76b2c612
......@@ -50,6 +50,15 @@ class UwWcmsBasicTest extends BrowserTestBase {
$this->createUsers();
// Create test Webform.
$this->drupalLogin($this->drupalUsers['uw_role_form_editor']);
$edit = [
'id' => 'test_form',
'title' => 'Test Form',
'status' => 'open',
];
$this->drupalPostForm('admin/structure/webform/add', $edit, 'Save');
// The variable $test_paths stores Drupal paths and permission information.
// In this array, the keys are paths. If the value is TRUE, everyone has
// access. Otherwise, the value must be an array of roles that have access.
......@@ -61,6 +70,29 @@ class UwWcmsBasicTest extends BrowserTestBase {
'uw_role_content_editor',
'uw_role_content_author',
],
// Webform.
'admin/structure/webform' => ['uw_role_form_editor', 'uw_role_form_results_access'],
'admin/structure/webform/add' => ['uw_role_form_editor'],
'admin/structure/webform/addons' => ['uw_role_form_editor'],
'admin/structure/webform/config' => ['uw_role_form_editor'],
'admin/structure/webform/config/advanced' => ['uw_role_form_editor'],
'admin/structure/webform/config/advanced' => ['uw_role_form_editor'],
'admin/structure/webform/config/elements' => ['uw_role_form_editor'],
'admin/structure/webform/config/exporters' => ['uw_role_form_editor'],
'admin/structure/webform/config/handlers' => ['uw_role_form_editor'],
'admin/structure/webform/config/libraries' => ['uw_role_form_editor'],
'admin/structure/webform/config/options/manage' => ['uw_role_form_editor'],
'admin/structure/webform/config/submissions' => ['uw_role_form_editor'],
'admin/structure/webform/config/variants' => ['uw_role_form_editor'],
'admin/structure/webform/help' => TRUE,
'admin/structure/webform/submissions/manage' => ['uw_role_form_editor', 'uw_role_form_results_access'],
// Test Webform.
'admin/structure/webform/manage/test_form' => ['uw_role_form_editor'],
'admin/structure/webform/manage/test_form/results/submissions' => ['uw_role_form_editor', 'uw_role_form_results_access'],
'admin/structure/webform/manage/test_form/settings' => ['uw_role_form_editor'],
'form/test-form' => TRUE,
'webform/test_form/test' => ['uw_role_form_editor'],
];
// Test these paths with each user.
foreach ($this->drupalUsers as $role => $user) {
......@@ -97,6 +129,8 @@ class UwWcmsBasicTest extends BrowserTestBase {
'uw_role_site_manager',
'uw_role_content_editor',
'uw_role_content_author',
'uw_role_form_editor',
'uw_role_form_results_access',
];
foreach ($roles as $role) {
$user = ['roles' => [$role]];
......
Supports Markdown
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