function DBLogTestCase::testDBLogCorrupted

Tests corrupted log entries can still display available data.

1 call to DBLogTestCase::testDBLogCorrupted()
DBLogTestCase::testDBLog in modules/dblog/dblog.test
Tests Database Logging module functionality through interfaces.

File

modules/dblog/dblog.test, line 71

Class

DBLogTestCase
Tests logging messages to the database.

Code

private function testDBLogCorrupted() {
    global $base_root;
    // Prepare the fields to be logged
    $log = array(
        'type' => 'custom',
        'message' => 'Log entry added to test the unserialize failure.',
        'variables' => 'BAD SERIALIZED DATA',
        'severity' => WATCHDOG_NOTICE,
        'link' => '',
        '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,
    );
    dblog_watchdog($log);
    // View the database log report page.
    $this->drupalGet('admin/reports/dblog');
    $this->assertResponse(200);
    $output = truncate_utf8(filter_xss(t('Log data is corrupted and cannot be unserialized: Log entry added to test unserialize failure.'), array()), 56, TRUE, TRUE);
    $this->assertText($output, 'Log data is corrupted and cannot be unserialized.');
}

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