From: Tim Otten Date: Wed, 3 Feb 2016 20:29:24 +0000 (-0700) Subject: CiviTest/bootstrap.php - Change env handling in `cv()` X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=2f928b89b4f325e56d54baefa82904b0370e8710;p=civicrm-core.git CiviTest/bootstrap.php - Change env handling in `cv()` In Ubuntu's php-cli, the php.ini overrides `variables_order` with `GPCS` -- which destroys `$_ENV`. This seems pretty stupid... perhaps they conflated `variables_order` with `request_order`. At any rate, we'll have to do statey-swappy `putenv()` things instead. --- diff --git a/tests/phpunit/CiviTest/bootstrap.php b/tests/phpunit/CiviTest/bootstrap.php index e04cd6a847..330c742259 100644 --- a/tests/phpunit/CiviTest/bootstrap.php +++ b/tests/phpunit/CiviTest/bootstrap.php @@ -39,8 +39,10 @@ if (CIVICRM_UF === 'UnitTests') { function cv($cmd, $decode = 'json') { $cmd = 'cv ' . $cmd; $descriptorSpec = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => STDERR); - $env = $_ENV + array('CV_OUTPUT' => 'json'); - $process = proc_open($cmd, $descriptorSpec, $pipes, __DIR__, $env); + $oldOutput = getenv('CV_OUTPUT'); + putenv("CV_OUTPUT=json"); + $process = proc_open($cmd, $descriptorSpec, $pipes, __DIR__); + putenv("CV_OUTPUT=$oldOutput"); fclose($pipes[0]); $result = stream_get_contents($pipes[1]); fclose($pipes[1]);