How to debug Drupal 8 Functional tests with XDebug

Submitted by Frederic Marand on Sun, 2018-07-29 21:12

The problem

While converting the old-style functional tests in the MongoDB project from WebTestBase to BrowserTestBase, I stumbled upon a problem: after following the drupal.org instructions to run PHPunit tests from PhpStorm, doing step-by-step debugging in the IDE worked nicely, but then stopped at the first $this->drupalLogin(); call, returning a 404 after a very long delay, although the same call running without debugging worked normally. What could be going on ?

Drupal tip of the day: PHPUnit 6 tests with composer-project/drupal-project

Submitted by Frederic Marand on Sat, 2018-07-21 09:31

The problem

When trying to run PHPUnit tests on the MongoDB contrib module for the soon-ready 8.2.0 version, I recently starting encountering this error:

PHPUnit testing framework version 6 or greater is required when running on PHP 7.0 or greater.
Run the command 'composer run-script drupal-phpunit-upgrade' in order to fix this.

OK, no big deal, let's just run that command.

# From $PROJECT/web/core directory
$ ../../vendor/bin/composer run-script drupal-phpunit-upgrade

In RunScriptCommand.php line 89:

Script "drupal-phpunit-upgrade" is not defined in this package
run-script [--timeout TIMEOUT] [--dev] [--no-dev] [-l|--list] [--] [] []...

Hmm, so I need that command but it is not defined in composer.json. So where is it ?

Go tip of the day : running tests for all subpackages recursively

Submitted by Frederic Marand on Sat, 2014-09-27 23:52

If you program in Go, you've probably written a lot of packages, and probably split packages in subpackages. Maybe even more than idiomatic Go would really advise... And you may have been grumbling just like I did at the fact that the go test command requires a list of packages, and does not recursively dive into all the subpackages, like PHPunit would, and does not seem to have a working recursion flag.