1.20.x dblog.test protected DBLogTestCase::getTypeCount(array $types)

Gets the count of database log entries by database log event type.

Parameters

array $types: The type information to compare against.

Return value

array: The count of each type keyed by the key of the $types array.

File

modules/dblog/tests/dblog.test, line 597
Tests for dblog.module.

Class

DBLogTestCase
Tests logging messages to the database.

Code

protected function getTypeCount(array $types) {
  $entries = $this->getLogEntries();
  $count = array_fill(0, count($types), 0);
  foreach ($entries as $entry) {
    foreach ($types as $key => $type) {
      if ($entry['type'] == $type['type'] && $entry['severity'] == $type['severity']) {
        $count[$key]++;
        break;
      }
    }
  }
  return $count;
}