*/
private static $_singleton = NULL;
+ /**
+ * The classes in CiviTest have ucky, non-standard naming.
+ *
+ * @var array
+ * Array(string $className => string $filePath).
+ */
+ private $civiTestClasses;
+
/**
* @param bool $force
*
*/
protected function __construct() {
$this->_registered = FALSE;
+ $this->civiTestClasses = array(
+ 'CiviCaseTestCase',
+ 'CiviDBAssert',
+ 'CiviMailUtils',
+ 'CiviReportTestCase',
+ 'CiviSeleniumTestCase',
+ 'CiviTestPdoUtils',
+ 'CiviTestSuite',
+ 'CiviUnitTestCase',
+ 'Contact',
+ 'ContributionPage',
+ 'Custom',
+ 'Event',
+ 'Membership',
+ 'Participant',
+ 'PaypalPro',
+ );
}
/**
require_once $file;
}
}
+ elseif (in_array($class, $this->civiTestClasses)) {
+ $file = "tests/phpunit/CiviTest/{$class}.php";
+ if (FALSE != stream_resolve_include_path($file)) {
+ require_once $file;
+ }
+ }
+ elseif ($class === 'CiviSeleniumSettings') {
+ if (!empty($GLOBALS['_CV'])) {
+ require_once 'tests/phpunit/CiviTest/CiviSeleniumSettings.auto.php';
+ }
+ elseif (CRM_Utils_File::isIncludable('tests/phpunit/CiviTest/CiviSeleniumSettings.php')) {
+ require_once 'tests/phpunit/CiviTest/CiviSeleniumSettings.php';
+ }
+ }
}
}
parent::__construct($name, $data, $dataName, $browser);
$this->loggedInAs = NULL;
- if (!empty($GLOBALS['_CV'])) {
- require_once 'CiviSeleniumSettings.auto.php';
- }
- elseif (CRM_Utils_File::isIncludable('CiviSeleniumSettings.php')) {
- require_once 'CiviSeleniumSettings.php';
- }
- else {
- throw new RuntimeException("Cannot initialize Selenium test. Please setup CiviSeleniumSettings.php or configure \"cv\".");
- }
$this->settings = new CiviSeleniumSettings();
if (property_exists($this->settings, 'serverStartupTimeOut') && $this->settings->serverStartupTimeOut) {
global $CiviSeleniumTestCase_polled;
* Utility functions
* @package CiviCRM
*/
-class Utils {
+class CiviTestPdoUtils {
/**
* PDO for the database.
/**
* Include class definitions
*/
-require_once 'tests/phpunit/Utils.php';
require_once 'api/api.php';
require_once 'CRM/Financial/BAO/FinancialType.php';
define('API_LATEST_VERSION', 3);
self::$_dbName = self::getDBName();
// create test database
- self::$utils = new Utils(CIVICRM_DSN);
+ self::$utils = new CiviTestPdoUtils(CIVICRM_DSN);
// also load the class loader
require_once 'CRM/Core/ClassLoader.php';
*/
public static function getDBName() {
static $dbName = NULL;
- if ($dbName === NULL ) {
+ if ($dbName === NULL) {
require_once "DB.php";
$dsninfo = DB::parseDSN(CIVICRM_DSN);
$dbName = $dsninfo['database'];
* 'template_path' Set to TRUE to use the default, FALSE or "" to disable support, or a string path to use another path
*/
public function customDirectories($customDirs) {
- require_once 'CRM/Core/Config.php';
$config = CRM_Core_Config::singleton();
if (empty($customDirs['php_path']) || $customDirs['php_path'] === FALSE) {
*/
protected function createParticipantWithContribution() {
// creating price set, price field
- require_once 'CiviTest/Event.php';
- require_once 'CiviTest/Contact.php';
$this->_contactId = Contact::createIndividual();
$this->_eventId = Event::create($this->_contactId);
$eventParams = array(