How to pass custom php.ini to phpunit?
Source uses
get_cfg_var
instead
ini_get
unfortunately, it does not use the values specified ini_set, -d, etc.
The only way to pass the value now is to use additional php.ini. How to pass this to phpunit?
Mountain Information:
I tried going with -d
phpunit --filter testgetdesc -d SIEF_VALIDATOR_DOC_ROOT="htdocs" --configuration tests/phpunit.xml tests/configHelperTest.php public function testgetdesc() { echo get_cfg_var("SIEF_VALIDATOR_DOC_ROOT")."---test---"; }
It just echoes "--- test ---"
The reason for this is also ini_set:
https://github.com/sebastianbergmann/phpunit/blob/master/PHPUnit/TextUI/Command.php
case 'd': { $ini = explode('=', $option[1]); if (isset($ini[0])) { if (isset($ini[1])) { ini_set($ini[0], $ini[1]); } else { ini_set($ini[0], TRUE); } } }
Also in phpunit.xml I have
<php> <ini name="SIEF_VALIDATOR_DOC_ROOT" value="bar"/> </php>
which does not work [and I do not expect this].
source share