protected function MongoDBLogTestCase::getTypeCount in MongoDB 7
Same name and namespace in other branches
- 8 mongodb_watchdog/mongodb_watchdog.test \MongoDBLogTestCase::getTypeCount()
- 6 mongodb_watchdog/mongodb_watchdog.test \MongoDBLogTestCase::getTypeCount()
Get the count of entries per 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.
1 call to MongoDBLogTestCase::getTypeCount()
- MongoDBLogTestCase::ztestFilter in mongodb_watchdog/
mongodb_watchdog.test - Test the dblog filter on admin/reports/dblog.
File
- mongodb_watchdog/
mongodb_watchdog.test, line 680 - Contains \MongoDBLogTestCase.
Class
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;
}