Skip to content

Commit

Permalink
Civi\API\ExternalBatch - Improve test for variables_order/$_ENV
Browse files Browse the repository at this point in the history
The recent revision civicrm#9595 updated `ExternalBatch` to produce a more
informative error message.  However, in the test environment used by
`flexmailer`, there was exactly 1 value in `$_ENV` (even if
`variables_order` was misconfigured).

This should make the test a bit harder to trip-up by affirmatively checking
for the most common environment variable.

Review note: In the known universe, the only direct references to
`ExternalBatch` are in `CiviUnitTestCase`, so this shouldn't impact any
runtime logic.
  • Loading branch information
totten committed Mar 13, 2017
1 parent e8b836d commit d590350
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Civi/API/ExternalBatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function __construct($defaultParams = array()) {
$this->settingsPath = defined('CIVICRM_SETTINGS_PATH') ? CIVICRM_SETTINGS_PATH : NULL;
$this->defaultParams = $defaultParams;
$this->env = $_ENV;
if (empty($_ENV)) {
if (empty($_ENV['PATH'])) {
// FIXME: If we upgrade to newer Symfony\Process and use the newer
// inheritEnv feature, then this becomes unnecessary.
throw new \CRM_Core_Exception('ExternalBatch cannot detect environment: $_ENV is missing. (Tip: Set variables_order=EGPCS in php.ini.)');
Expand Down

0 comments on commit d590350

Please sign in to comment.