You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears that PHPUnit does not (in all cases?) verify whether its own PHP extension requirements have been satisfied.
While for Composer installs, this shouldn't be (much of) an issue as Composer will verify on install, for running PHPUnit via the Phar, however, this can lead to unexpected error notices (without backtrace).
The Composer require section lists the following requirements, though not all of these appear to be "hard" requirements:
When the Mbstring extension is disabled and a non-testdox test run is requested, all will be fine and the test progress and results display correctly.
However, when the Mbstring extension is disabled and --testdox is used, this will result in a Call to undefined function mb_strtolower() notice being thrown without indication where it's coming from.
Based on a quick code base search, AFAICS this is caused by this function call:
Make sure the mbstring extension is disabled (from the php.ini file or otherwise).
Run the following command using a PHPUnit Phar file on PHPUnit's own test suite and see the tests pass without issues:
phpunit --filter TestBuilderTest
Next, run the same command with --testdox enabled:
phpunit --testdox --filter TestBuilderTest
See the Call to undefined function mb_strtolower() notice appear without indication of the file it came from (even when Xdebug is turned on) and no test results displayed.
Expected behavior
Either an error before the test run starts saying that the Mbstring extension should be enabled when using the --testdox option or a graceful fall-back to strtolower() when Mbstring is not available.
Extra information
Discovered when testing @requires conditions on an external test, where one of the @requires was for the Mbstring extension 😂
The text was updated successfully, but these errors were encountered:
Summary
It appears that PHPUnit does not (in all cases?) verify whether its own PHP extension requirements have been satisfied.
While for Composer installs, this shouldn't be (much of) an issue as Composer will verify on install, for running PHPUnit via the Phar, however, this can lead to unexpected error notices (without backtrace).
The Composer
require
section lists the following requirements, though not all of these appear to be "hard" requirements:phpunit/composer.json
Lines 24 to 30 in fb9b833
Current behavior
When the Mbstring extension is disabled and a non-testdox test run is requested, all will be fine and the test progress and results display correctly.
However, when the Mbstring extension is disabled and
--testdox
is used, this will result in aCall to undefined function mb_strtolower()
notice being thrown without indication where it's coming from.Based on a quick code base search, AFAICS this is caused by this function call:
phpunit/src/Util/TestDox/NamePrettifier.php
Line 116 in fb9b833
How to reproduce
mbstring
extension is disabled (from thephp.ini
file or otherwise).--testdox
enabled:Call to undefined function mb_strtolower()
notice appear without indication of the file it came from (even when Xdebug is turned on) and no test results displayed.Expected behavior
Either an error before the test run starts saying that the Mbstring extension should be enabled when using the
--testdox
option or a graceful fall-back tostrtolower()
when Mbstring is not available.Extra information
Discovered when testing
@requires
conditions on an external test, where one of the@requires
was for the Mbstring extension 😂The text was updated successfully, but these errors were encountered: