You are here

protected function ControllerTest::assertTypeCount in MongoDB 8.2

Asserts that the counts for displayed entries match the expected counts.

Parameters

array $types: The type information to compare against.

1 call to ControllerTest::assertTypeCount()
ControllerTest::testFilter in modules/mongodb_watchdog/tests/src/Functional/ControllerTest.php
Test the dblog filter on admin/reports/dblog.

File

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

Class

ControllerTest
Test the MongoDB report controllers.

Namespace

Drupal\Tests\mongodb_watchdog\Functional

Code

protected function assertTypeCount(array $types) {
  $entries = $this
    ->getLogEntries();
  $reducer = function ($accu, $curr) {
    $accu[$curr['type'] . '-' . $curr['severity']] = [
      $curr['type'],
      $curr['severity'],
    ];
    return $accu;
  };
  $actual = array_reduce($entries, $reducer, []);
  $expected = array_reduce($types, $reducer, []);
  $this
    ->assertEquals($expected, $actual, "Inserted events are found on page");
}