Commit ecdb9516 authored by Liam Morland's avatar Liam Morland
Browse files

ISTWCMS-3968: Create UwWcmsBasicTest::drupalUsers, ::createUsers()

parent 842fd46e
......@@ -30,6 +30,13 @@ class UwWcmsBasicTest extends BrowserTestBase {
*/
protected $strictConfigSchema = FALSE;
/**
* Array of user objects keyed by the role they have.
*
* @var array
*/
public $drupalUsers = [];
/**
* Basic test.
*/
......@@ -42,4 +49,26 @@ class UwWcmsBasicTest extends BrowserTestBase {
$this->assertFalse($big_pipe_enabled, 'BigPipe module is not enabled.');
}
/**
* Populate $drupalUsers with an array of users with various roles.
*/
private function createUsers() {
// Test if property is already populated.
if ($this->drupalUsers) {
return;
}
// Create users.
$this->drupalUsers = ['anonymous user' => NULL];
$roles = [
'authenticated user',
'uw_role_site_manager',
'uw_role_content_editor',
'uw_role_content_author',
];
foreach ($roles as $role) {
$user = ['roles' => [$role]];
$this->drupalUsers[$role] = $this->createUser([], $role, FALSE, $user);
}
}
}
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