private function DBLogTestCase::generateLogEntries
7.x dblog.test | private DBLogTestCase::generateLogEntries($count, $type = 'custom', $severity = WATCHDOG_NOTICE) |
Generates a number of random database log events.
Parameters
int $count: Number of watchdog entries to generate.
string $type: (optional) The type of watchdog entry. Defaults to 'custom'.
int $severity: (optional) The severity of the watchdog entry. Defaults to WATCHDOG_NOTICE.
2 calls to DBLogTestCase::generateLogEntries()
- DBLogTestCase::testFilter in drupal-7.x/
modules/ dblog/ dblog.test - Tests the database log filter functionality at admin/reports/dblog.
- DBLogTestCase::verifyCron in drupal-7.x/
modules/ dblog/ dblog.test - Verifies that cron correctly applies the database log row limit.
File
- drupal-7.x/
modules/ dblog/ dblog.test, line 119 - Tests for dblog.module.
Class
- DBLogTestCase
- Tests logging messages to the database.
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,
'uid' => isset($this->big_user->uid) ? $this->big_user->uid : 0,
'request_uri' => $base_root . request_uri(),
'referer' => $_SERVER['HTTP_REFERER'],
'ip' => ip_address(),
'timestamp' => REQUEST_TIME,
);
$message = 'Log entry added to test the dblog row limit. Entry #';
for ($i = 0; $i < $count; $i++) {
$log['message'] = $message . $i;
dblog_watchdog($log);
}
}