Skip to content

Commit 2a40e8d

Browse files
authored
Clean up PHPUnit bootstrap inclusion
Remove unnecessary class map entry for PhpunitCompatibilityTrait, drop `require_once` for bootstrap.php to avoid any odd side effects later on.
1 parent c149cae commit 2a40e8d

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/Drupal/DrupalAutoloader.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,7 @@ public function register(Container $container): void
102102

103103
// @todo stop requiring the bootstrap.php and just copy what is needed.
104104
if (interface_exists(\PHPUnit\Framework\Test::class)) {
105-
require_once $this->drupalRoot . '/core/tests/bootstrap.php';
106-
107-
// class_alias is not supported by OptimizedDirectorySourceLocator or AutoloadSourceLocator,
108-
// so we manually load this PHPUnit compatibility trait that exists in Drupal 8.
109-
$phpunitCompatTraitFilepath = $this->drupalRoot . '/core/tests/Drupal/Tests/PhpunitCompatibilityTrait.php';
110-
if (file_exists($phpunitCompatTraitFilepath)) {
111-
require_once $phpunitCompatTraitFilepath;
112-
$this->autoloader->addClassMap(['Drupal\\Tests\\PhpunitCompatibilityTrait' => $phpunitCompatTraitFilepath]);
113-
}
105+
require $this->drupalRoot . '/core/tests/bootstrap.php';
114106
}
115107

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

0 commit comments

Comments
 (0)