Skip to content

Commit 7808f25

Browse files
authored
Merge pull request #298 from stronk7/deprecate_phpdbg
Deprecate the phpdbg option for code coverage
2 parents f1624f3 + cdfb095 commit 7808f25

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

docs/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ This project adheres to [Semantic Versioning](http://semver.org/).
99
The format of this change log follows the advice given at [Keep a CHANGELOG](http://keepachangelog.com).
1010

1111
## [Unreleased]
12+
### Deprecated
13+
- The use of `phpdbg` to calculate PHPUnit's code-coverage has been deprecated in this `moodle-plugin-ci` release (4.5.0) and will be removed in 5.0.0. This includes both the implicit (default) option when no alternative (`pcov` or `xdebug`) is available and the explicit `--coverage-phpdbg` option.
14+
- ACTION SUGGESTED: In order to avoid deprecation warnings or annotations, proceed to ensure that either `pcov` (Moodle 3.10 and up) or `xdebug` are available and they will be used automatically. Note that any use of `phpdbg` will throw an error in the next major release (5.0.0).
15+
16+
### Fixed
17+
- Solved a problem with the validation of `dataformat` plugin lang strings.
1218

1319
## [4.4.5] - 2024-04-03
1420
### Changed

docs/CLI.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2133,7 +2133,7 @@ Use the xdebug extension to calculate code coverage
21332133

21342134
#### `--coverage-phpdbg`
21352135

2136-
Use the phpdbg binary to calculate code coverage
2136+
(**DEPRECATED**) Use the phpdbg binary to calculate code coverage
21372137

21382138
* Accept value: no
21392139
* Is value required: no

src/Command/PHPUnitCommand.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ protected function configure(): void
4747
->addOption('coverage-clover', null, InputOption::VALUE_NONE, 'Generate code coverage report in Clover XML format')
4848
->addOption('coverage-pcov', null, InputOption::VALUE_NONE, 'Use the pcov extension to calculate code coverage')
4949
->addOption('coverage-xdebug', null, InputOption::VALUE_NONE, 'Use the xdebug extension to calculate code coverage')
50-
->addOption('coverage-phpdbg', null, InputOption::VALUE_NONE, 'Use the phpdbg binary to calculate code coverage')
50+
->addOption('coverage-phpdbg', null, InputOption::VALUE_NONE, '(**DEPRECATED**) Use the phpdbg binary to calculate code coverage')
5151
->addOption('fail-on-incomplete', null, InputOption::VALUE_NONE, 'Treat incomplete tests as failures')
5252
->addOption('fail-on-risky', null, InputOption::VALUE_NONE, 'Treat risky tests as failures')
5353
->addOption('fail-on-skipped', null, InputOption::VALUE_NONE, 'Treat skipped tests as failures')
@@ -195,6 +195,15 @@ private function resolveBinary(InputInterface $input, OutputInterface $output):
195195
'-dxdebug.mode=coverage',
196196
];
197197
case 'phpdbg':
198+
// @codeCoverageIgnoreStart
199+
if (!defined('PHPUNIT_TEST')) { // Only show deprecation warnings in non-test environments.
200+
if (getenv('GITHUB_ACTIONS')) { // Only show deprecation annotations in GitHub Actions.
201+
echo '::warning title=Deprecated phpdbg option::The use of phpdbg for phpunit code coverage ' .
202+
'is deprecated and will be removed in 5.0.0. Please, switch to pcov or xdebug instead.' . PHP_EOL;
203+
}
204+
}
205+
// @codeCoverageIgnoreEnd
206+
198207
return [
199208
'phpdbg',
200209
'-d',

0 commit comments

Comments
 (0)