public function CleanerTest::testCleanerClearWatchdog in Cleaner 8
Test Cleaner clearing watchdog logs.
File
- src/
Tests/ CleanerTest.php, line 68
Class
- CleanerTest
- Class CleanerTest.
Namespace
Drupal\cleaner\TestsCode
public function testCleanerClearWatchdog() {
$this
->setConfig('cleaner_empty_watchdog', 1);
for ($i = 0; $i <= 10; $i++) {
\Drupal::service('cleaner_logger')
->log(LogLevel::INFO, $this
->randomString());
}
$this
->assertTrue(self::getWatchdogLogsCount() >= 10, 'Logger sucessfully generated logs');
self::cleanerExecute();
$this
->assertTrue(self::getWatchdogLogsCount() <= 1, 'Logs has been sucessfully wiped');
}