function ModuleInfoTest::providerTestTestModulePackages
Provides test module info files and their expected packages.
File
-
core/
tests/ Drupal/ Tests/ Core/ Extension/ ModuleInfoTest.php, line 47
Class
- ModuleInfoTest
- Tests that core module info files have the expected keys.
Namespace
Drupal\Tests\Core\ExtensionCode
public static function providerTestTestModulePackages() : \Generator {
$root = dirname(__DIR__, 6);
// These modules deliberately use other packages to test module metadata.
$expected_packages = [
'config_mapping_test' => 'Core',
'experimental_module_requirements_test' => 'Core (Experimental)',
'experimental_module_test' => 'Core (Experimental)',
'nyan_cat' => 'Core',
];
$modules = (new ExtensionDiscovery($root))->scan('module', TRUE);
foreach ($modules as $module) {
if (!str_contains($module->getPath(), '/tests/modules/')) {
continue;
}
$filename = $root . '/' . $module->getPathname();
$info = Yaml::decode(file_get_contents($filename));
if (!empty($info['hidden'])) {
continue;
}
$package = $expected_packages[$module->getName()] ?? 'Testing';
yield $module->getPathname() => [
$filename,
$package,
];
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.