Skip to content

Commit d5fa167

Browse files
committed
Try another loading hack
1 parent c20cb6b commit d5fa167

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Drupal/DrupalAutoloader.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,10 @@ public function register(Container $container): void
104104

105105
// class_alias is not supported by OptimizedDirectorySourceLocator or AutoloadSourceLocator,
106106
// so we manually load this PHPUnit compatibility trait that exists in Drupal 8.
107-
if (file_exists($this->drupalRoot . '/core/tests/Drupal/Tests/PhpunitCompatibilityTrait.php')) {
108-
require_once $this->drupalRoot . '/core/tests/Drupal/Tests/PhpunitCompatibilityTrait.php';
107+
$phpunitCompatTraitFilepath = $this->drupalRoot . '/core/tests/Drupal/Tests/PhpunitCompatibilityTrait.php';
108+
if (file_exists($phpunitCompatTraitFilepath)) {
109+
require_once $phpunitCompatTraitFilepath;
110+
$this->autoloader->addClassMap(['Drupal\\Tests\\PhpunitCompatibilityTrait' => $phpunitCompatTraitFilepath]);
109111
}
110112

111113
foreach ($this->moduleData as $extension) {

0 commit comments

Comments
 (0)