By mondrake on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
11.0.x
Introduced in version:
11.0.0
Description:
In PHPUnit 9 (Drupal 10), the class providing HTML output logging was controlled by the printerClass attribute in the phpunit.xml configuration file (or via the --printer command line parameter):
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="tests/bootstrap.php" colors="true"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutChangesToGlobalState="true"
failOnWarning="true"
printerClass="\Drupal\Tests\Listeners\HtmlOutputPrinter"
cacheResult="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
In PHPUnit 10 (Drupal 11), listeners were removed, and HTML output logging is now provided by the HtmlOutputLogger extension, configured in phpunit.xml:
<extensions>
<!-- Functional tests HTML output logging. -->
<bootstrap class="Drupal\TestTools\Extension\HtmlLogging\HtmlOutputLogger">
<parameter name="outputDirectory" value="sites/simpletest/browser_output"/>
<parameter name="verbose" value="true"/>
</bootstrap>
</extensions>
The extension has two parameters:
- outputDirectory - indicating where the output pages are stored, defaults to
sites/simpletest/browser_output - verbose - indicating if the list of all pages produced should be output in the test report, defaults to
true
The parameters can be respectively overridden by the value of the following environment variables, so that CI scripts can change the setup without changing the xml configuration file:
- BROWSERTEST_OUTPUT_DIRECTORY - if set to empty string '', the output is disabled
- BROWSERTEST_OUTPUT_VERBOSE
If a module uses a custom phpunit.xml configuration file, the extension must be configured if HTML output is required.
Impacts:
Module developers
Site templates, recipes and distribution developers