| 1 |
<?php |
<?php |
| 2 |
// $Id: dblog.test,v 1.12 2008/12/11 20:35:37 dries Exp $ |
// $Id: dblog.test,v 1.13 2008/12/24 10:38:41 dries Exp $ |
| 3 |
|
|
| 4 |
class DBLogTestCase extends DrupalWebTestCase { |
class DBLogTestCase extends DrupalWebTestCase { |
| 5 |
protected $big_user; |
protected $big_user; |
| 165 |
$this->doNode('page'); |
$this->doNode('page'); |
| 166 |
$this->doNode('poll'); |
$this->doNode('poll'); |
| 167 |
|
|
| 168 |
// When a user is deleted, any content they created remains but the |
// When a user account is canceled, any content they created remains but the |
| 169 |
// uid = 0. Their blog entry shows as "'s blog" on the home page. Records |
// uid = 0. Their blog entry shows as "'s blog" on the home page. Records |
| 170 |
// in the watchdog table related to that user have the uid set to zero. |
// in the watchdog table related to that user have the uid set to zero. |
| 171 |
} |
} |
| 202 |
} |
} |
| 203 |
$count_before = (isset($ids)) ? count($ids) : 0; |
$count_before = (isset($ids)) ? count($ids) : 0; |
| 204 |
$this->assertTrue($count_before > 0, t('DBLog contains @count records for @name', array('@count' => $count_before, '@name' => $user->name))); |
$this->assertTrue($count_before > 0, t('DBLog contains @count records for @name', array('@count' => $count_before, '@name' => $user->name))); |
| 205 |
|
|
| 206 |
|
// Login the admin user. |
| 207 |
|
$this->drupalLogin($this->big_user); |
| 208 |
// Delete user. |
// Delete user. |
| 209 |
user_delete(array(), $user->uid); |
// We need to POST here to invoke batch_process() in the internal browser. |
| 210 |
|
$this->drupalPost('user/' . $user->uid . '/cancel', array('user_cancel_method' => 'user_cancel_reassign'), t('Cancel account')); |
| 211 |
|
|
| 212 |
// Count rows that have uids for the user. |
// Count rows that have uids for the user. |
| 213 |
$count = db_result(db_query('SELECT COUNT(wid) FROM {watchdog} WHERE uid = %d', $user->uid)); |
$count = db_result(db_query('SELECT COUNT(wid) FROM {watchdog} WHERE uid = %d', $user->uid)); |
| 214 |
$this->assertTrue($count == 0, t('DBLog contains @count records for @name', array('@count' => $count, '@name' => $user->name))); |
$this->assertTrue($count == 0, t('DBLog contains @count records for @name', array('@count' => $count, '@name' => $user->name))); |
| 230 |
} |
} |
| 231 |
$this->assertTrue(!isset($ids), t('DBLog contains no records for @name', array('@name' => $user->name))); |
$this->assertTrue(!isset($ids), t('DBLog contains no records for @name', array('@name' => $user->name))); |
| 232 |
|
|
|
// Login the admin user. |
|
|
$this->drupalLogin($this->big_user); |
|
| 233 |
// View the dblog report. |
// View the dblog report. |
| 234 |
$this->drupalGet('admin/reports/dblog'); |
$this->drupalGet('admin/reports/dblog'); |
| 235 |
$this->assertResponse(200); |
$this->assertResponse(200); |