Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
PHPUnit tests can fail based on the php.ini settings on different environments. E.g. Memory limit
Proposed resolution
We can set memory limits and error reporting levels in the phpunit.xml.dist configuration file so that tests will always run correctly of different environments like this:
<php>
<ini name="error_reporting" value="32767"/>
<ini name="memory_limit" value="-1"/>
</php>
Remaining tasks
Discuss what the correct php ini settings should be and add them phpunit.xml.dist
Comment | File | Size | Author |
---|---|---|---|
#3 | 2205799_phpunit_config-3.patch | 584 bytes | Cameron Tod |
#1 | 2205799_phpunit_config.patch | 473 bytes | davidgrayston |
Comments
Comment #1
davidgrayston CreditAttribution: davidgrayston commentedComment #2
dawehnerShould we maybe document what 32767 means? +1 to set memory limit to -1. We already hit the 100MB limit.
Comment #3
Cameron Tod CreditAttribution: Cameron Tod commentedI think we should! Comments added.
Comment #4
alexpottSo I think this change makes sense.
Looking at the PHPUnit error handler code
This will return FALSE if your PHP is configured with
error_reporting = E_ALL & ~E_NOTICE
and the error number is for a E_NOTICE. Therefore even though PHPUnit is configured withby default (http://phpunit.de/manual/3.7/en/appendixes.configuration.html) this actually does not occur.
Setting the error_reporting value in PHPUnit config is a simple fix.
Comment #5
dawehnerOh cool, E_STRICT is now part of E_ALL.
Comment #6
catchCommitted/pushed to 8.x, thanks!