Page MenuHomeDevCentral

Allow arc unit to cope with phpunit configuration
Closed, ResolvedPublic

Description

From monorepo rKERUALD, tests systematically seems to fail when invoked from root.

From core/omnitools directory, arc unit currently works, but we forgot to set backupGlobals there in 9917e84c.

Event Timeline

dereckson triaged this task as High priority.Sat, Apr 18, 13:03
dereckson created this task.

There are still two things to do:

(1) ask Arcanist to use phpunit.xml file -> at this stage it adds properly -c /home/dereckson/dev/keruald/_monorepo/core/phpunit.xml in the configuration

(2) update PhpunitTestEngine code to call the relevant coverage extension properly


With (1) applied, we've the following command:

WindRiver
$ phpunit -c /home/dereckson/dev/keruald/_monorepo/core/phpunit.xml -d display_errors=stderr --log-junit /tmp/aqcfqpm6a3so04kc/5063-JHhPU3 --coverage-clover /tmp/5z4uau1rygw0kkww/5063-LfUjjB /home/dereckson/dev/keruald/_monorepo/core/omnitools/tests/HTTP/Requests/RequestTest.php
Switching to Composer phpunit:
PHPUnit 12.5-dev by Sebastian Bergmann and contributors.

Runtime:       PHP 8.3.30
Configuration: /home/dereckson/dev/keruald/_monorepo/core/phpunit.xml

There was 1 PHPUnit test runner warning:

1) XDEBUG_MODE=coverage (environment variable) or xdebug.mode=coverage (PHP configuration setting) has to be set

No tests executed!

Removing the --coverage-clover <path> option runs properly the tests.

Tests would run correctly with XDEBUG_MODE set:

WindRiver
$ setenv XDEBUG_MODE coverage
$ phpunit -c /home/dereckson/dev/keruald/_monorepo/core/phpunit.xml -d display_errors=stderr --log-junit /tmp/aqcfqpm6a3so04kc/5063-JHhPU3 --coverage-clover /tmp/5z4uau1rygw0kkww/5063-LfUjjB /home/dereckson/dev/keruald/_monorepo/core/omnitools/tests/HTTP/Requests/RequestTest.php
Switching to Composer phpunit:
PHPUnit 12.5-dev by Sebastian Bergmann and contributors.

Runtime:       PHP 8.3.30 with Xdebug 3.5.1
Configuration: /home/dereckson/dev/keruald/_monorepo/core/phpunit.xml

.................                                                 17 / 17 (100%)

Time: 00:00.239, Memory: 24.00 MB

OK (17 tests, 27 assertions)

Generating code coverage report in Clover XML format ... done [00:00.096]

Note we can ourselves set the variable:

WindRiver
$ setenv XDEBUG_MODE coverage
$ arc unit
   PASS  198ms   Keruald\OmniTools\Tests\HTTP\Requests\RequestTest

Arcanist code has been patched in our production branch @ https://github.com/nasqueron/arcanist

Would probably be nice to check if that's needed in phorge version too.

dereckson claimed this task.