You are here

protected function DbLogTest::getLogEntries in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/dblog/tests/src/Functional/DbLogTest.php \Drupal\Tests\dblog\Functional\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.
2 calls to DbLogTest::getLogEntries()
DbLogTest::getTypeCount in core/modules/dblog/tests/src/Functional/DbLogTest.php
Gets the count of database log entries by database log event type.
DbLogTest::testSameTimestampEntries in core/modules/dblog/tests/src/Functional/DbLogTest.php
Test sorting for entries with the same timestamp.

File

core/modules/dblog/tests/src/Functional/DbLogTest.php, line 718

Class

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

Namespace

Drupal\Tests\dblog\Functional

Code

protected function getLogEntries() {
  $entries = [];
  if ($table = $this
    ->getLogsEntriesTable()) {
    foreach ($table as $row) {
      $cells = $row
        ->findAll('css', 'td');
      $entries[] = [
        'severity' => $this
          ->getSeverityConstant($row
          ->getAttribute('class')),
        'type' => $cells[1]
          ->getText(),
        'message' => $cells[3]
          ->getText(),
        'user' => $cells[4]
          ->getText(),
      ];
    }
  }
  return $entries;
}