Can't accesss cv from CiviUnitTestCase::createExternalAPI in buildkit environment
The error message says sh: 1: cv not found, so the symptom here is that the proc_open() call is unable to find the executable cv.

It looked like the place to check this should be cv() function in tests/phpunit/CiviTest/bootstrap.php ... but I wasn't able to get that to work.

Having investigated, I suspect that this may be an issue in \Civi\API\ExternalBatch. In that class's constructor,

$this-&gt;env = $_ENV;


At this point in the tests, $_ENV = ['CIVICRM_UF' =&gt; 'UnitTests']. There is no path here, and the call to cv fails. Manually inserting a PATH into $_ENV here does restore the ability to call cv, but then fails with a further "malformed response" error, "Failed to determine INI file path.".

This must be working on tests.civicrm.org, so perhaps it's a configuration issue that affects both our test environments?


civicrm/cv#1 is this issue?
Tim suggests it may relate to Debian's default variables_order being GPCS no EGPCS
Suggests: https://gist.github.com/totten/cf76679b4fabdae4c86e06f8c0988b23