function PhpUnitTestRunner::summarizeResults
Same name in other branches
- 9 core/lib/Drupal/Core/Test/PhpUnitTestRunner.php \Drupal\Core\Test\PhpUnitTestRunner::summarizeResults()
- 10 core/lib/Drupal/Core/Test/PhpUnitTestRunner.php \Drupal\Core\Test\PhpUnitTestRunner::summarizeResults()
- 11.x core/lib/Drupal/Core/Test/PhpUnitTestRunner.php \Drupal\Core\Test\PhpUnitTestRunner::summarizeResults()
Tallies test results per test class.
@internal
Parameters
string[][] $results: Array of results in the {simpletest} schema. Can be the return value of PhpUnitTestRunner::runTests().
Return value
int[][] Array of status tallies, keyed by test class name and status type.
File
-
core/
lib/ Drupal/ Core/ Test/ PhpUnitTestRunner.php, line 241
Class
- PhpUnitTestRunner
- Run PHPUnit-based tests.
Namespace
Drupal\Core\TestCode
public function summarizeResults(array $results) {
$summaries = [];
foreach ($results as $result) {
if (!isset($summaries[$result['test_class']])) {
$summaries[$result['test_class']] = [
'#pass' => 0,
'#fail' => 0,
'#exception' => 0,
'#debug' => 0,
];
}
switch ($result['status']) {
case 'pass':
$summaries[$result['test_class']]['#pass']++;
break;
case 'fail':
$summaries[$result['test_class']]['#fail']++;
break;
case 'exception':
$summaries[$result['test_class']]['#exception']++;
break;
case 'debug':
$summaries[$result['test_class']]['#debug']++;
break;
}
}
return $summaries;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.