1 standard.test | StandardInstallTestCase::testRolesExist() |
Tests existence of test case located in an installation profile module.
File
- core/
modules/ simpletest/ tests/ standard.test, line 17 - Tests for the Standard Installation Profile.
Class
- StandardInstallTestCase
- Verifies settings created in the Standard profile are correct.
Code
function testRolesExist() {
$user_1 = user_load(1);
$this->assertTrue(user_has_role('administrator', $user_1), 'User ID 1 is an administrator');
// Create a user assigned to the editor role.
$edit = array();
$edit['name'] = $this->randomName();
$edit['mail'] = $edit['name'] . '@example.com';
$edit['pass'] = user_password();
$edit['status'] = 1;
$edit['roles'] = array('editor');
$editor_account = entity_create('user', $edit);
$editor_account->save();
$editor_account->pass_raw = $edit['pass'];
// Just check that the role exists and that the user can see the dashboard.
$this->backdropLogin($editor_account);
$this->assertUrl('admin/dashboard');
}