You are here

protected function DbLogTest::getLogEntries in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/dblog/src/Tests/DbLogTest.php \Drupal\dblog\Tests\DbLogTest::getLogEntries()

Gets the database log event information from the browser page.

Return value

array List of log events where each event is an array with following keys:

  • severity: (int) A database log severity constant.
  • type: (string) The type of database log event.
  • message: (string) The message for this database log event.
  • user: (string) The user associated with this database log event.
1 call to DbLogTest::getLogEntries()
DbLogTest::getTypeCount in core/modules/dblog/src/Tests/DbLogTest.php
Gets the count of database log entries by database log event type.

File

core/modules/dblog/src/Tests/DbLogTest.php, line 609
Contains \Drupal\dblog\Tests\DbLogTest.

Class

DbLogTest
Generate events and verify dblog entries; verify user access to log reports based on permissions.

Namespace

Drupal\dblog\Tests

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;
}