From: Tim Otten Date: Fri, 22 Jan 2016 11:24:44 +0000 (-0800) Subject: CRM-17860 - CiviTest - Use unified civicrm.settings.php X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=534e937c4c456181056997b37b59cc55b0254446;p=civicrm-core.git CRM-17860 - CiviTest - Use unified civicrm.settings.php The wiring to load civicrm.settings.php is all over the place. With this patch, most use-cases (runtime, headless test, web test) will go through one `civicrm.settings.php`. This requires the `cv` command. --- diff --git a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php index 2a30190389..a4d69e5775 100644 --- a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php +++ b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php @@ -25,18 +25,8 @@ +--------------------------------------------------------------------+ */ -/** - * Include configuration - */ -define('CIVICRM_SETTINGS_PATH', __DIR__ . '/civicrm.settings.dist.php'); -define('CIVICRM_SETTINGS_LOCAL_PATH', __DIR__ . '/civicrm.settings.local.php'); define('CIVICRM_WEBTEST', 1); -if (file_exists(CIVICRM_SETTINGS_LOCAL_PATH)) { - require_once CIVICRM_SETTINGS_LOCAL_PATH; -} -require_once CIVICRM_SETTINGS_PATH; - /** * Base class for CiviCRM Selenium tests * diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php index 958a2acb1e..c952af0dfb 100755 --- a/tests/phpunit/CiviTest/CiviUnitTestCase.php +++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php @@ -28,16 +28,6 @@ use Civi\Payment\System; -/** - * Include configuration - */ -define('CIVICRM_SETTINGS_PATH', __DIR__ . '/civicrm.settings.dist.php'); -define('CIVICRM_SETTINGS_LOCAL_PATH', __DIR__ . '/civicrm.settings.local.php'); - -if (file_exists(CIVICRM_SETTINGS_LOCAL_PATH)) { - require_once CIVICRM_SETTINGS_LOCAL_PATH; -} -require_once CIVICRM_SETTINGS_PATH; /** * Include class definitions */ diff --git a/tests/phpunit/CiviTest/bootstrap.php b/tests/phpunit/CiviTest/bootstrap.php index e688e6d26c..b87d9e2522 100644 --- a/tests/phpunit/CiviTest/bootstrap.php +++ b/tests/phpunit/CiviTest/bootstrap.php @@ -1,15 +1,8 @@ array("pipe", "r"), 1 => array("pipe", "w"), 2 => STDERR); + $env = $_ENV + array('CV_OUTPUT' => 'json'); + $process = proc_open($cmd, $descriptorSpec, $pipes, __DIR__, $env); + fclose($pipes[0]); + $bootCode = stream_get_contents($pipes[1]); + fclose($pipes[1]); + if (proc_close($process) !== 0) { + throw new RuntimeException("Command failed ($cmd)"); + } + return $raw ? $bootCode : json_decode($bootCode, 1); +} diff --git a/tests/phpunit/WebTest/Utils/RedirectTest.php b/tests/phpunit/WebTest/Utils/RedirectTest.php index 39d5df94d0..910d050bf2 100644 --- a/tests/phpunit/WebTest/Utils/RedirectTest.php +++ b/tests/phpunit/WebTest/Utils/RedirectTest.php @@ -23,23 +23,11 @@ | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ */ - require_once 'CiviTest/CiviUnitTestCase.php'; require_once 'CiviTest/CiviSeleniumSettings.php'; -/** - * Include configuration - */ -define('CIVICRM_SETTINGS_PATH', __DIR__ . '/civicrm.settings.dist.php'); -define('CIVICRM_SETTINGS_LOCAL_PATH', __DIR__ . '/civicrm.settings.local.php'); define('CIVICRM_WEBTEST', 1); -if (file_exists(CIVICRM_SETTINGS_LOCAL_PATH)) { - require_once CIVICRM_SETTINGS_LOCAL_PATH; -} -require_once CIVICRM_SETTINGS_PATH; - - /** * Check that we handle redirects appropriately. */