| 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
Summary
the --no-extensions cli option does not apply to the
<extension>element configured in thephpunit.xmlCurrent behavior
while passing the
--no-extensionscli option, extensions configured in the extension element ofphpunit.xmlare loaded when running phpunit.i'm not sure whether this is intended behaviour or an oversight tho (happens here)
phpunit/src/TextUI/Configuration/Merger.php
Lines 164 to 183 in 6770c48
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