You are here

protected function ControllerTest::getLogEntries in MongoDB 8.2

Get the log entry information form the page.

Return value

array List of entries and their information.

1 call to ControllerTest::getLogEntries()
ControllerTest::assertTypeCount in modules/mongodb_watchdog/tests/src/Functional/ControllerTest.php
Asserts that the counts for displayed entries match the expected counts.

File

modules/mongodb_watchdog/tests/src/Functional/ControllerTest.php, line 282

Class

ControllerTest
Test the MongoDB report controllers.

Namespace

Drupal\Tests\mongodb_watchdog\Functional

Code

protected function getLogEntries() : array {
  $entries = [];
  if ($table = $this
    ->getLogsEntriesTable()) {

    /** @var \Behat\Mink\Element\NodeElement $row */
    foreach ($table as $row) {

      /** @var \Behat\Mink\Element\NodeElement[] $cells */
      $cells = $row
        ->findAll('css', 'td');
      $entries[] = [
        'severity' => $this
          ->getSeverityConstant($cells[2]
          ->getAttribute('class')),
        'type' => $cells[3]
          ->getText(),
        'message' => $cells[4]
          ->getText(),
      ];
    }
  }
  return $entries;
}