public function TestFileParser::getTestListFromFile in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Test/RunTests/TestFileParser.php \Drupal\Core\Test\RunTests\TestFileParser::getTestListFromFile()
- 10 core/lib/Drupal/Core/Test/RunTests/TestFileParser.php \Drupal\Core\Test\RunTests\TestFileParser::getTestListFromFile()
Gets the classes from a PHP file.
Parameters
string $file: The path to the file to parse.
Return value
string[] Array of fully qualified class names within the PHP file.
File
- core/
lib/ Drupal/ Core/ Test/ RunTests/ TestFileParser.php, line 24
Class
- TestFileParser
- Parses class names from PHP files without loading them.
Namespace
Drupal\Core\Test\RunTestsCode
public function getTestListFromFile($file) {
$test_list = $this
->parseContents(file_get_contents($file));
return array_filter($test_list, function ($class) {
return is_subclass_of($class, TestCase::class) || is_subclass_of($class, TestBase::class);
});
}