function StatisticsAdminTestCase::testDeleteUser

Tests that accesslog reflects when a user is deleted.

File

modules/statistics/statistics.test, line 404

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, $account->uid, $account->mail));
    $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.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.