function StatisticsAdminTestCase::testDeleteUser
7.x statistics.test | StatisticsAdminTestCase::testDeleteUser() |
Tests that accesslog reflects when a user is deleted.
File
- drupal-7.x/
modules/ statistics/ statistics.test, line 400 - Tests for the Statistics module.
Class
- StatisticsAdminTestCase
- Tests the statistics administration screen.
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), 'User is not found in the database.');
$this->drupalGet('admin/reports/visitors');
$this->assertNoText($account->name, 'Did not find user in visitor statistics.');
}