Tests that accesslog reflects when a user is deleted.
function testDeleteUser() {
config('statistics.settings')
->set('access_log.enabled', 1)
->save();
config('user.settings')
->set('cancel_method', 'user_cancel_delete')
->save();
$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.
$mails = $this
->drupalGetMails();
$mail = end($mails);
preg_match('@http.+?(user/\\d+/cancel/confirm/\\d+/[^\\s]+)@', $mail['body'], $matches);
$path = $matches[1];
$this
->drupalGet($path);
$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.');
}