function CasetrackerAdminTest::testCasetrackerAdminCreation in Case Tracker 6
Same name and namespace in other branches
- 7 tests/casetracker_admin.test \CasetrackerAdminTest::testCasetrackerAdminCreation()
Main test routine.
File
- tests/
casetracker_admin.test, line 26
Class
Code
function testCasetrackerAdminCreation() {
$auth_user = $this
->drupalCreateUser(array(
'administer case tracker',
));
$this
->drupalLogin($auth_user);
// Create a case state
foreach (array(
'priority',
'status',
'type',
) as $realm) {
$edit = array(
'name' => $this
->randomName(32),
'realm' => $realm,
);
$this
->drupalPost('admin/settings/casetracker/states/add', $edit, t('Submit'));
$text = t('The case state !name has been created', array(
'!name' => $edit['name'],
));
$this
->assertText($text);
}
// Update a case state.
foreach (array(
'priority',
'status',
'type',
) as $realm) {
$states = casetracker_realm_load($realm);
$csid = array_pop(array_keys($states));
$edit = array(
'name' => $this
->randomName(32),
);
$this
->drupalPost('admin/settings/casetracker/states/edit/' . $csid, $edit, t('Submit'));
$text = t('The case state !name has been updated', array(
'!name' => $edit['name'],
));
$this
->assertText($text);
}
// Reset the state cache after the above updates.
casetracker_case_state_load(null, null, true);
// Delete a case state.
foreach (array(
'priority',
'status',
'type',
) as $realm) {
$states = casetracker_realm_load($realm);
$csid = array_pop(array_keys($states));
$this
->drupalPost('admin/settings/casetracker/states/delete/' . $csid, array(), t('Delete'));
$text = t('Deleted case state !name', array(
'!name' => $states[$csid],
));
$this
->assertText($text);
}
}