Skip to content

--no-extensions CLI option only prevents extension PHARs from being loaded #5073

@wickedOne

Description

@wickedOne
Q A
PHPUnit version 9.5.25
PHP version 8.1
Installation Method Composer

Summary

the --no-extensions cli option does not apply to the <extension> element configured in the phpunit.xml

Current behavior

while passing the --no-extensions cli option, extensions configured in the extension element of phpunit.xml are loaded when running phpunit.

i'm not sure whether this is intended behaviour or an oversight tho (happens here)

$loadPharExtensions = true;
if ($cliConfiguration->hasNoExtensions() && $cliConfiguration->noExtensions()) {
$loadPharExtensions = false;
}
$pharExtensionDirectory = null;
if ($xmlConfiguration->phpunit()->hasExtensionsDirectory()) {
$pharExtensionDirectory = $xmlConfiguration->phpunit()->extensionsDirectory();
}
$extensionBootstrappers = [];
foreach ($xmlConfiguration->extensions() as $extension) {
$extensionBootstrappers[] = [
'className' => $extension->className(),
'parameters' => $extension->parameters(),
];
}

How to reproduce

minimal, self-contained test case to reproduce can be found over here

Expected behavior

the extensions configured in the extension element are not loaded like the ones from the pharDirectory

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions