StatisticsAdminTestCase::testDeleteUser

7 statistics.test StatisticsAdminTestCase::testDeleteUser()
8 statistics.test StatisticsAdminTestCase::testDeleteUser()

Tests that accesslog reflects when a user is deleted.

File

modules/statistics/statistics.test, line 366
Tests for statistics.module.

Code

function testDeleteUser() {
  variable_set('statistics_enable_access_log', 1);

  variable_set('user_cancel_method', 'user_cancel_delete');
  $this->drupalLogout($this->privileged_user);
  $account = $this->drupalCreateUser(array('access content', 'cancel account'));
  $this->drupalLogin($account);
  $this->drupalGet('node/' . $this->test_node->nid);

  $account = user_load($account->uid, TRUE);

  $this->drupalGet('user/' . $account->uid . '/edit');
  $this->drupalPost(NULL, NULL, t('Cancel account'));

  $timestamp = time();
  $this->drupalPost(NULL, NULL, t('Cancel account'));
  // Confirm account cancellation request.
  $this->drupalGet("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login));
  $this->assertFalse(user_load($account->uid, TRUE), t('User is not found in the database.'));

  $this->drupalGet('admin/reports/visitors');
  $this->assertNoText($account->name, t('Did not find user in visitor statistics.'));
}
Login or register to post comments