You are here

protected function MongoDBLogTestCase::getLogEntries in MongoDB 6

Same name and namespace in other branches
  1. 8 mongodb_watchdog/mongodb_watchdog.test \MongoDBLogTestCase::getLogEntries()
  2. 7 mongodb_watchdog/mongodb_watchdog.test \MongoDBLogTestCase::getLogEntries()

Get the log entry information form the page.

Return value

array List of entries and their information.

1 call to MongoDBLogTestCase::getLogEntries()
MongoDBLogTestCase::getTypeCount in mongodb_watchdog/mongodb_watchdog.test
Get the count of entries per type.

File

mongodb_watchdog/mongodb_watchdog.test, line 528
Test class for MongoDB_watchdog.

Class

MongoDBLogTestCase
Test the behaviour of watchdog() mongodb_watchdog, not dblog.

Code

protected function getLogEntries() {
  $entries = array();
  if ($table = $this
    ->xpath('.//table[@id="admin-dblog"]')) {
    $table = array_shift($table);
    foreach ($table->tbody->tr as $row) {
      $entries[] = array(
        'severity' => $this
          ->getSeverityConstant($row['class']),
        'type' => $this
          ->asText($row->td[1]),
        'message' => $this
          ->asText($row->td[3]),
        'user' => $this
          ->asText($row->td[4]),
      );
    }
  }
  return $entries;
}