private function MongoDBLogTestCase::generateLogEntries in MongoDB 8
Same name and namespace in other branches
- 6 mongodb_watchdog/mongodb_watchdog.test \MongoDBLogTestCase::generateLogEntries()
- 7 mongodb_watchdog/mongodb_watchdog.test \MongoDBLogTestCase::generateLogEntries()
Generate dblog entries.
Parameters
integer $count: Number of log entries to generate.
$type: The type of watchdog entry.
$severity: The severity of the watchdog entry.
1 call to MongoDBLogTestCase::generateLogEntries()
- MongoDBLogTestCase::ZtestFilter in mongodb_watchdog/
mongodb_watchdog.test - Test the dblog filter on admin/reports/dblog.
File
- mongodb_watchdog/
mongodb_watchdog.test, line 242 - Test class for MongoDB_watchdog.
Class
- MongoDBLogTestCase
- Test the behaviour of watchdog() mongodb_watchdog, not dblog
Code
private function generateLogEntries($count, $type = 'custom', $severity = WATCHDOG_NOTICE) {
global $base_root;
// Prepare the fields to be logged
$log = array(
'type' => $type,
'message' => 'Log entry added to test the dblog row limit.',
'variables' => array(),
'severity' => $severity,
'link' => NULL,
'user' => $this->big_user,
'request_uri' => $base_root . request_uri(),
'referer' => $_SERVER['HTTP_REFERER'],
'ip' => ip_address(),
'timestamp' => $this->request_time,
);
$message = 'Log entry added to test the dblog row limit.';
for ($i = 0; $i < $count; $i++) {
$log['message'] = $this
->randomString();
dblog_watchdog($log);
}
}