- if (!empty($byInterface['HeadlessInterface']) && CIVICRM_UF !== 'UnitTests') {
- $testNames = implode(', ', array_keys($byInterface['HeadlessInterface']));
- throw new \RuntimeException("Suite includes headless tests ($testNames) which require CIVICRM_UF=UnitTests.\n\n$blurb");
- }
- if (!empty($byInterface['EndToEndInterface']) && CIVICRM_UF === 'UnitTests') {
- $testNames = implode(', ', array_keys($byInterface['EndToEndInterface']));
- throw new \RuntimeException("Suite includes end-to-end tests ($testNames) which do not support CIVICRM_UF=UnitTests.\n\n$blurb");
- }
- }
-
- /**
- * Call the "cv" command.
- *
- * This duplicates the standalone `cv()` wrapper that is recommended in bootstrap.php.
- * This duplication is necessary because `cv()` is optional, and downstream implementers
- * may alter, rename, or omit the wrapper, and (by virtue of its role in bootstrap) there
- * it is impossible to define it centrally.
- *
- * @param string $cmd
- * The rest of the command to send.
- * @param string $decode
- * Ex: 'json' or 'phpcode'.
- * @return string
- * Response output (if the command executed normally).
- * @throws \RuntimeException
- * If the command terminates abnormally.
- */
- protected function cv($cmd, $decode = 'json') {
- $cmd = 'cv ' . $cmd;
- $descriptorSpec = [0 => ["pipe", "r"], 1 => ["pipe", "w"], 2 => STDERR];
- $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]);
- if (proc_close($process) !== 0) {
- throw new \RuntimeException("Command failed ($cmd):\n$result");
+ if (!empty($byInterface['HeadlessInterface']) && CIVICRM_UF !== 'UnitTests') {
+ $testNames = implode(', ', array_keys($byInterface['HeadlessInterface']));
+ throw new \RuntimeException("Suite includes headless tests ($testNames) which require CIVICRM_UF=UnitTests.\n\n$blurb");
+ }
+ if (!empty($byInterface['EndToEndInterface']) && CIVICRM_UF === 'UnitTests') {
+ $testNames = implode(', ', array_keys($byInterface['EndToEndInterface']));
+ throw new \RuntimeException("Suite includes end-to-end tests ($testNames) which do not support CIVICRM_UF=UnitTests.\n\n$blurb");
+ }