function TestFileParser::getTestListFromFile
Same name in other branches
- 9 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()
- 11.x 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);
});
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.