function PhpUnitTestDiscovery::getTestList
Returns a list of tests from a TestSuite object.
Parameters
\PHPUnit\Framework\TestSuite $phpUnitTestSuite: The TestSuite object returned by PHPUnit test discovery.
string|null $extension: The name of an extension to limit discovery to; e.g., 'node'.
Return value
array<string<array<class-string, array{name: class-string, description: string, group: string|int, groups: list<string|int>, type: string, file: string, tests_count: positive-int}>>> An array of test groups keyed by the group name. Each test group is an array of test class information arrays as returned by ::getTestClassInfo(), keyed by test class. If a test class belongs to multiple groups, it will appear under all group keys it belongs to.
1 call to PhpUnitTestDiscovery::getTestList()
- PhpUnitTestDiscovery::getTestClasses in core/
lib/ Drupal/ Core/ Test/ PhpUnitTestDiscovery.php - Discovers available tests.
File
-
core/
lib/ Drupal/ Core/ Test/ PhpUnitTestDiscovery.php, line 179
Class
- PhpUnitTestDiscovery
- Discovers available tests using the PHPUnit API.
Namespace
Drupal\Core\TestCode
private function getTestList(TestSuite $phpUnitTestSuite, ?string $extension) : array {
$list = [];
foreach ($phpUnitTestSuite->tests() as $testSuite) {
foreach ($testSuite->tests() as $testClass) {
if ($extension !== NULL && !str_starts_with($testClass->name(), "Drupal\\Tests\\{$extension}\\")) {
continue;
}
$item = $this->getTestClassInfo($testClass, $this->reverseMap[$testSuite->name()] ?? $testSuite->name());
foreach ($item['groups'] as $group) {
$list[$group][$item['name']] = $item;
}
}
}
return $list;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.