You are here

function UserDeleteTest::testUserDeleteAdminInterface in User Delete 6

Check admin inteface has not changed and settings ar stored.

File

./user_delete.test, line 46
Test the basic functions of the user delete module.

Class

UserDeleteTest
Inactive user module testcase.

Code

function testUserDeleteAdminInterface() {

  // Login as administrator
  $this
    ->drupalLogin($this->admin);

  // Verify that the following fields exist. Warning, select list may fail.
  $this
    ->drupalGet('admin/user/user_delete');
  $defaults = array(
    'user_delete_default_action' => variable_get('user_delete_default_action', 0),
    'user_delete_redirect' => variable_get('user_delete_redirect', ''),
    'user_delete_backup' => variable_get('user_delete_backup', 0),
    'user_delete_backup_period' => variable_get('user_delete_backup_period', 60 * 60 * 24 * 7 * 12),
  );
  foreach ($defaults as $name => $value) {
    $this
      ->assertFieldByName($name, $value, t('Default @field field found successfully.', array(
      '@field' => $name,
    )));
  }

  // Save new settings and verify they are saved.
  $options = array(
    'user_delete_default_action' => 'user_delete_block',
    'user_delete_redirect' => '<front>',
    'user_delete_backup' => true,
    'user_delete_backup_period' => '4838400',
  );
  $this
    ->drupalPost('admin/user/user_delete', $options, t('Save configuration'));
  foreach ($defaults as $name => $value) {
    $this
      ->assertEqual($defaults[$name], $value, t('Option %field saved successfully.', array(
      '%field' => $name,
    )));
  }
}