function UserDeleteTest::testUserDeleteInterface in User Delete 6
Check admin inteface has not changed and settings ar stored.
File
- ./
user_delete.test, line 86 - Test the basic functions of the user delete module.
Class
- UserDeleteTest
- Inactive user module testcase.
Code
function testUserDeleteInterface() {
// Try an unpriviledge user,
$account = $this
->drupalCreateUser();
$this
->drupalLogin($this->account);
// By default the user may select the delete option.
$this
->drupalGet('user/' . $this->account->uid . '/edit');
$this
->assertNoFieldById('edit-delete', t('Delete Account button not found.'));
// try with a priviledge account.
$this
->drupalLogin($this->account);
// By default the user may select the delete option.
$this
->drupalGet('user/' . $this->account->uid . '/edit');
$this
->assertFieldById('edit-delete', t('Delete Account'), t('Delete Account button found.'));
// Try to delete this account
$this
->drupalPost('user/' . $this->account->uid . '/edit', array(), t('Delete Account'));
// User should be able to select the delete action. First option is to
// disable and keep content.
$this
->assertField('user_delete_action', 'user_delete_block', t('Delete options found in Confirmation found.'));
/**
* Now change behavior and select a default option for the users.
* Users will not be able to select how to delete their account.
*/
variable_set('user_delete_default_action', 'user_delete_block');
$this
->drupalPost('user/' . $this->account->uid . '/edit', array(), t('Delete Account'));
// User should be able to select the delete action. First option is to
// disable and keep content.
$this
->assertNoField('user_delete_action', t('Delete options not found in confirmation form.'));
$this
->assertText(t('The account will be disabled, all submitted content will be kept.'), t('Text for user delete with selected option found.'));
}