File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 6060 },
6161 "require-dev" : {
6262 "phpstan/phpstan-strict-rules" : " ^1.5 || ^2.0" ,
63- "drupal/core" : " *"
63+ "drupal/core" : " *" ,
64+ "phpunit/phpunit" : " *"
6465 }
6566}
Original file line number Diff line number Diff line change @@ -22,6 +22,11 @@ class CICommands extends Tasks
2222 */
2323 protected const PHPCS_DEFAULT_PHP_VERSION = '8.1 ' ;
2424
25+ /**
26+ * The maximum PHPUnit version that allows the --verbose flag.
27+ */
28+ protected const PHPUNIT_MAX_VERSION_WITH_VERBOSE_FLAG = 9 ;
29+
2530 /**
2631 * RoboFile constructor.
2732 */
@@ -35,9 +40,22 @@ public function __construct()
3540 * Command to run unit tests.
3641 *
3742 * @aliases punit
43+ *
44+ * @todo Remove support for PHPUnit --verbose syntax in next major Usher
45+ * version.
3846 */
3947 public function jobRunUnitTests (): Result
4048 {
49+ exec ("phpunit --version | awk '{print $2}' " , $ output , $ result_code );
50+ if ($ result_code === 0 ) {
51+ $ major_version = (int ) $ output [0 ];
52+ if ($ major_version > self ::PHPUNIT_MAX_VERSION_WITH_VERBOSE_FLAG ) {
53+ return $ this ->taskExec (
54+ 'XDEBUG_MODE=coverage vendor/bin/phpunit --debug --log-events-verbose-text phpunit.log '
55+ )->run ();
56+ }
57+ }
58+ // Default to old PHPUnit verbose flag syntax.
4159 return $ this ->taskExec ('XDEBUG_MODE=coverage vendor/bin/phpunit --debug --verbose ' )->run ();
4260 }
4361
You can’t perform that action at this time.
0 commit comments