'referer' => \Drupal::
request()->server->
get('HTTP_REFERER'
),
'ip' => '127.0.0.1',
'timestamp' => REQUEST_TIME,
];
// Add a watchdog entry.
$this->container->
get('logger.dblog'
)->
log($log['severity'
],
$log['message'
],
$log);
// Make sure the table count has actually been incremented.
$this->
assertEquals($count + 1,
(int) $connection->
select('watchdog'
)->
countQuery()->
execute()->
fetchField(),
new FormattableMarkup('\Drupal\dblog\Logger\DbLog->log() added an entry to the dblog :count',
[':count' =>
$count]));
// Log in the admin user.
$this->
drupalLogin($this->adminUser
);
// Post in order to clear the database table.
$this->
clearLogsEntries();
// Confirm that the logs should be cleared.
$this->
submitForm([], 'Confirm'
);
// Count the rows in watchdog that previously related to the deleted user.
$count =
$connection->
select('watchdog'
)->
countQuery()->
execute()->
fetchField();
$this->
assertEquals(0,
$count,
new FormattableMarkup('DBLog contains :count records after a clear.',
[':count' =>
$count]));
} /**
* Tests the database log filter functionality at admin/reports/dblog.
*/
public function testFilter() {