public static function dsn($part = NULL) {
if (!isset(self::$singletons['dsn'])) {
require_once "DB.php";
- self::$singletons['dsn'] = \DB::parseDSN(CIVICRM_DSN);
+ $dsn = \CRM_Utils_SQL::autoSwitchDSN(CIVICRM_DSN);
+ self::$singletons['dsn'] = \DB::parseDSN($dsn);
}
if ($part === NULL) {
/**
* Create a builder for the headless environment.
*
- * @return \Civi\Test\CiviEnvBuilder
- *
- * @code
+ * ```
* \Civi\Test::headless()->apply();
* \Civi\Test::headless()->sqlFile('ex.sql')->apply();
- * @endCode
+ * ```
+ *
+ * @return \Civi\Test\CiviEnvBuilder
*/
public static function headless() {
$civiRoot = dirname(__DIR__);
/**
* Create a builder for end-to-end testing on the live environment.
*
- * @return \Civi\Test\CiviEnvBuilder
- *
- * @code
+ * ```
* \Civi\Test::e2e()->apply();
* \Civi\Test::e2e()->install('foo.bar')->apply();
- * @endCode
+ * ```
+ *
+ * @return \Civi\Test\CiviEnvBuilder
*/
public static function e2e() {
$builder = new \Civi\Test\CiviEnvBuilder('CiviEnvBuilder');
*/
public static function codeGen() {
if (!isset(self::$singletons['codeGen'])) {
- $civiRoot = dirname(__DIR__);
+ $civiRoot = str_replace(DIRECTORY_SEPARATOR, '/', dirname(__DIR__));
$codeGen = new \CRM_Core_CodeGen_Main("$civiRoot/CRM/Core/DAO", "$civiRoot/sql", $civiRoot, "$civiRoot/templates", NULL, "UnitTests", NULL, "$civiRoot/xml/schema/Schema.xml", NULL);
$codeGen->init();
self::$singletons['codeGen'] = $codeGen;