* We typically call authenticate only when we need to bootstrap the CMS
* directly via Civi and hence bypass the normal CMS auth and bootstrap
* process typically done in CLI and cron scripts. See: CRM-12648
+ *
+ * Q: Can we move this to the userSystem class so that it can be tuned
+ * per-CMS? For example, when dealing with UnitTests UF, there's no
+ * userFrameworkDSN.
*/
$session = CRM_Core_Session::singleton();
$session->set('civicrmInitSession', TRUE);
- $dbDrupal = DB::connect($config->userFrameworkDSN);
+ if ($config->userFrameworkDSN) {
+ $dbDrupal = DB::connect($config->userFrameworkDSN);
+ }
return $config->userSystem->authenticate($name, $password, $loadCMSBootstrap, $realPath);
}
return $retVal;
}
+ /**
+ * Bootstrap the phony CMS.
+ *
+ * @param string $name
+ * Optional username for login.
+ * @param string $pass
+ * Optional password for login.
+ *
+ * @return bool
+ */
+ public function loadBootStrap($name = NULL, $pass = NULL) {
+ return TRUE;
+ }
+
/**
* @inheritDoc
*/
$civicrm_root = dirname(__DIR__);
chdir($civicrm_root);
- require_once 'civicrm.config.php';
+ if (getenv('CIVICRM_SETTINGS')) {
+ require_once getenv('CIVICRM_SETTINGS');
+ }
+ else {
+ require_once 'civicrm.config.php';
+ }
// autoload
if (!class_exists('CRM_Core_ClassLoader')) {
require_once $civicrm_root . '/CRM/Core/ClassLoader.php';
--- /dev/null
+<?php
+// This file is loaded when spawning separate CLI processes that need to
+// talk to the test DB.
+
+require_once dirname(dirname(dirname(__DIR__))) . '/CRM/Core/ClassLoader.php';
+CRM_Core_ClassLoader::singleton()->register();
+
+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;