private static function KernelTestBase::getModulesToEnable in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::getModulesToEnable()
Returns the modules to enable for this test.
Parameters
string $class: The fully-qualified class name of this test.
Return value
array
1 call to KernelTestBase::getModulesToEnable()
- KernelTestBase::bootKernel in core/
tests/ Drupal/ KernelTests/ KernelTestBase.php - Bootstraps a kernel for a test.
File
- core/
tests/ Drupal/ KernelTests/ KernelTestBase.php, line 961
Class
- KernelTestBase
- Base class for functional integration tests.
Namespace
Drupal\KernelTestsCode
private static function getModulesToEnable($class) {
$modules = [];
while ($class) {
if (property_exists($class, 'modules')) {
// Only add the modules, if the $modules property was not inherited.
$rp = new \ReflectionProperty($class, 'modules');
if ($rp->class == $class) {
$modules[$class] = $class::$modules;
}
}
$class = get_parent_class($class);
}
// Modules have been collected in reverse class hierarchy order; modules
// defined by base classes should be sorted first. Then, merge the results
// together.
$modules = array_reverse($modules);
return call_user_func_array('array_merge_recursive', $modules);
}