MDL-49294 logging: Improve cleanup tests

This commit is contained in:
Andrew Nicols 2015-03-31 14:11:04 +08:00
parent 78045f6583
commit ea3a71faf7
2 changed files with 6 additions and 18 deletions

View File

@ -296,15 +296,9 @@ class logstore_legacy_store_testcase extends advanced_testcase {
// Remove all logs before "today".
set_config('loglifetime', 1);
try {
ob_start();
$clean = new \logstore_legacy\task\cleanup_task();
$clean->execute();
ob_end_clean();
} catch (Exception $e) {
ob_end_clean();
throw $e;
}
$this->expectOutputString(" Deleted old legacy log records\n");
$clean = new \logstore_legacy\task\cleanup_task();
$clean->execute();
$this->assertEquals(1, $DB->count_records('log'));
}

View File

@ -306,15 +306,9 @@ class logstore_standard_store_testcase extends advanced_testcase {
// Remove all logs before "today".
set_config('loglifetime', 1, 'logstore_standard');
try {
ob_start();
$clean = new \logstore_standard\task\cleanup_task();
$clean->execute();
ob_end_clean();
} catch (Exception $e) {
ob_end_clean();
throw $e;
}
$this->expectOutputString(" Deleted old log records from standard store.\n");
$clean = new \logstore_standard\task\cleanup_task();
$clean->execute();
$this->assertEquals(1, $DB->count_records('logstore_standard_log'));
}