protected function MongoDBLogTestCase::getTypeCount in MongoDB 8
Same name and namespace in other branches
- 6 mongodb_watchdog/mongodb_watchdog.test \MongoDBLogTestCase::getTypeCount()
- 7 mongodb_watchdog/mongodb_watchdog.test \MongoDBLogTestCase::getTypeCount()
Get the count of entries per type.
Parameters
$types: The type information to compare against.
Return value
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 648 - Test class for MongoDB_watchdog.
Class
- MongoDBLogTestCase
- Test the behaviour of watchdog() mongodb_watchdog, not dblog
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;
}