function DBLogTestCase::testDBLogException

Verifies that exceptions are caught in dblog_watchdog().

File

modules/dblog/dblog.test, line 556

Class

DBLogTestCase
Tests logging messages to the database.

Code

protected function testDBLogException() {
    $log = array(
        'type' => 'custom',
        'message' => 'Log entry added to test watchdog handling of Exceptions.',
        'variables' => array(),
        'severity' => WATCHDOG_NOTICE,
        'link' => NULL,
        'user' => $this->big_user,
        'uid' => isset($this->big_user->uid) ? $this->big_user->uid : 0,
        'request_uri' => request_uri(),
        'referer' => $_SERVER['HTTP_REFERER'],
        'ip' => ip_address(),
        'timestamp' => REQUEST_TIME,
    );
    // Remove watchdog table temporarily to simulate it missing during
    // installation.
    db_query("DROP TABLE {watchdog}");
    // Add a watchdog entry.
    // This should not throw an Exception, but fail silently.
    dblog_watchdog($log);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.