define('CIVICRM_TEST', 1);
eval(cv('php:boot --level=settings', 'phpcode'));
+if (CIVICRM_UF === 'UnitTests') {
+ Civi\Test::headless()->apply();
+}
+
// ------------------------------------------------------------------------------
/**
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]);