ddev / ddev-drupal-contrib

DDEV integration for developing Drupal contrib projects
Apache License 2.0
68 stars 15 forks source link

Drupal 11 support for `ddev phpunit` #65

Open mscieszka opened 1 week ago

mscieszka commented 1 week ago

I have installed Drupal 11.0-dev to investigate issues with the phpunit (next major) pipeline in https://gitlab.com/drupalspoons/devel/-/jobs/7146821758. Pipeline from gitlab templates invokes phpunit differently than ddev-drupal-contrib:

sudo -u www-data -E vendor/bin/phpunit  --bootstrap /builds/drupalspoons/devel/web/core/tests/bootstrap.php /builds/drupalspoons/devel/web/modules/custom/devel --log-junit /builds/drupalspoons/devel/junit.xml  

When I try to run phpunit in my local project using ddev phpunit, I get the following error: obraz

The PHPUnit 10.5 documentation seems to indicate that there is no --printer flag.

In .ddev/commands/phpunit there is the following code: phpunit --printer="\Drupal\Tests\Listeners\HtmlOutputPrinter" --bootstrap $PWD/$DDEV_DOCROOT/core/tests/bootstrap.php --testdox $DDEV_DOCROOT/modules/custom "$@"

I have noticed that HtmlOutputPrinter is present in Drupal 10.3, but has been moved/removed/modified in 11.x.

After some digging I have found Drupal\TestTools\Extension\HtmlLogging\HtmlOutputLogger that might be helpful.

However, simply removing --printer="\Drupal\TestTools\Extension\HtmlLogging\HtmlOutputLogger" part of the command so that only phpunit --bootstrap $PWD/$DDEV_DOCROOT/core/tests/bootstrap.php --testdox $DDEV_DOCROOT/modules/custom "$@" remains, allows phpunit to run properly (still, I am not sure if output is formatted/handled as expected): obraz

weitzman commented 1 week ago

FYI We removed --testdox recently in https://github.com/ddev/ddev-drupal-contrib/pull/63.

We do want to keep the browser output so lets see how to fix this properly.