Merge pull request #12356 from pradpnayak/issue-202
[civicrm-core.git] / tests / phpunit / CiviTest / bootstrap.php
index e04cd6a8471fb200e818a8cb99d214fbf6a2d4a7..d50ff31fadaef4550c8714ec856223e24013d9a5 100644 (file)
@@ -19,7 +19,7 @@ define('CIVICRM_TEST', 1);
 eval(cv('php:boot --level=settings', 'phpcode'));
 
 if (CIVICRM_UF === 'UnitTests') {
-  CiviTester::builder()->apply();
+  Civi\Test::headless()->apply();
 }
 
 // ------------------------------------------------------------------------------
@@ -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]);