diff --git a/core/tests/bootstrap.php b/core/tests/bootstrap.php index a19c6d8..b82cd22 100644 --- a/core/tests/bootstrap.php +++ b/core/tests/bootstrap.php @@ -20,7 +20,8 @@ function drupal_phpunit_find_module_directories($scan_directory) { $dir = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($scan_directory, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS)); foreach ($dir as $d) { if (strpos($d->getPathname(), 'info.yml') !== FALSE) { - $module_directories[] = $d->getPathInfo()->getRealPath(); + // Cut of ".info.yml" from the filename and use that as module name. + $module_directories[substr($d->getFilename(), 0, -9)] = $d->getPathInfo()->getRealPath(); } } @@ -54,14 +55,14 @@ function drupal_phpunit_find_site_module_directories($sites_path) { * An array of module directories. */ function drupal_phpunit_register_module_dirs(Composer\Autoload\ClassLoader $loader, $dirs) { - foreach ($dirs as $dir) { + foreach ($dirs as $module => $dir) { $lib_path = $dir . '/lib'; if (is_dir($lib_path)) { - $loader->add('Drupal\\' . basename($dir), $lib_path); + $loader->add('Drupal\\' . $module, $lib_path); } $tests_path = $dir . '/tests'; if (is_dir($tests_path)) { - $loader->add('Drupal\\' . basename($dir), $tests_path); + $loader->add('Drupal\\' . $module, $tests_path); } } }