Skip to content

Commit 9ca8659

Browse files
committed
Remove the PHPUnit --verbose option from Moodle >= 5.0 runs
Also, within GH workflows, emit a warning about it being removed.
1 parent bafaf16 commit 9ca8659

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/Command/PHPUnitCommand.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,20 @@ private function resolveOptions(InputInterface $input): array
127127
];
128128
}
129129
if ($input->getOption('verbose')) {
130-
$options[] = [
131-
'--verbose',
132-
];
130+
if ($this->moodle->getBranch() <= 405) { // Only available with PHPUnit <= 9.x (Moodle <= 4.5).
131+
$options[] = [
132+
'--verbose',
133+
];
134+
} else {
135+
// @codeCoverageIgnoreStart
136+
if (!defined('PHPUNIT_TEST')) { // Only show deprecation warnings in non-test environments.
137+
if (getenv('GITHUB_ACTIONS')) { // Only show deprecation annotations in GitHub Actions.
138+
echo '::warning title=Deprecated PHPUnit --verbose option::The --verbose option was removed for ' .
139+
' PHPUnit 10, so it will be ignored by this run (Moodle >= 5.0)' . PHP_EOL;
140+
}
141+
}
142+
// @codeCoverageIgnoreEnd
143+
}
133144
}
134145
foreach (['fail-on-incomplete', 'fail-on-risky', 'fail-on-skipped', 'fail-on-warning', 'testdox'] as $option) {
135146
if ($input->getOption($option)) {

0 commit comments

Comments
 (0)