Setup CI/CD with both test reports and coverage on PHPUnit 10.x
To see it and almost not believe it:
- Drupal
core-dev
, phpstan, and all of their dependencies will conspire to prevent you from using PHPUnit 10.x, since they all requirePHPUnit < 9.x
. - Can't install PHPUnit 10.x at the Drupal root (breaks drupal-recommended), or at the contrib module (breaks Gitlab's Composer merge ops).
- No PHPUnit 10.x
===
no coverage, but I was having none of that.
Resolution:
- Installed PHPUnit 10.x directly in the Gitlab Docker container, overriding the default Gitlab CI template for phpunit.
- Locally, some type hinting is still needed for coverage to be user-friendly, so added a new
tools/phpunit
directory with the desired PHPUnit and respectivecomposer.json
, that way the new PHPUnit does not grief Drupal core or Gitlab CI.
About those coverage stats now... well, that's a battle for another day, but the groundwork has been done at the Gitlab level.
Pix or didn't happen: