function testZendConfigSettingsGetEnvironmentReturnsAnArrayOfEnvironments() { $this->assertContains('local', Zend_ConfigSettings::getEnvironments()); $this->assertContains('staging', Zend_ConfigSettings::getEnvironments()); $this->assertContains('test', Zend_ConfigSettings::getEnvironments()); $this->assertContains('development', Zend_ConfigSettings::getEnvironments()); }
/** * Gathers or configuration settings for DataCash * * @param string $configPath * @param string $file */ function __construct($configPath = null, $file = null) { if (null !== $configPath && null !== $file) { Zend_ConfigSettings::setUpConfig($configPath, $file); } else { Zend_ConfigSettings::setUpConfig(); } $config = Zend_Registry::get('general'); $this->_datacash = Zend_Registry::get($config->environment)->datacash; }
/** * Constructs our Dynamic DB settings, basically sets up our configurations * & constructs our parents functionality. * * @access public * */ public function __construct($env = null) { parent::__construct(); $this->_schemas = array(); if (null !== $env) { $this->_fixMan = new FixturesManager($env); } else { $this->_fixMan = new FixturesManager(); } Zend_ConfigSettings::setUpConfig(); $this->_general = Zend_Registry::get('general'); }
/** * Constructor * * Initialize environment, root path, and configuration. * * @param string $env * @param string|null $root * @return void */ public function __construct($root = null) { if (null === $root) { $root = realpath(dirname(__FILE__) . '/../'); } $this->_root = $root; Zend_SetupInit::setupInit(); $this->_front = Zend_Controller_Front::getInstance(); $this->_initErrorReporting(); $tmz = Zend_ConfigSettings::setupTimeZone(); date_default_timezone_set($tmz); }
/** * Checks that if test data is setup, that * it is in the expected format, also sets * the timezone ready for later. * * @access public * */ public function __construct() { if (null !== $this->_fixtures) { foreach ($this->_fixtures as $fixture) { if (!is_array($fixture)) { throw new Zend_Exception('Fixture data in unexpected format, should be an array of arrays'); } } } $tmz = Zend_ConfigSettings::setupTimeZone(); date_default_timezone_set($tmz); }
/** * Copies table data from development to test * * Copies table data from a table in the development databse to one in the test database * Connects to the dev database, fetches all records * then connects to the test db and does th inserts * * @param string $table The name of the table to copy * @access public */ public function loadTable($table) { // get the development database Zend_ConfigSettings::setUpConfigEnv('development'); Zend_ConfigSettings::setUpDBAdapter(); $devDb = Zend_Registry::get('db'); // get the test database Zend_ConfigSettings::setUpConfigEnv('local'); Zend_ConfigSettings::setUpDBAdapter(); $testDb = Zend_Registry::get('db'); $stmt = $devDb->query("SELECT * FROM {$table}"); $tableData = $stmt->fetchAll(); if ($tableData) { $testDb->query("TRUNCATE TABLE {$table}"); foreach ($tableData as $tableRow) { $data = array(); foreach ($tableRow as $key => $value) { $data[$key] = $value; } $testDb->insert($table, $data); } } }
/** * Constructor * * Initialize environment, root path, and configuration. * * @access public * @param String $path Path to configuration file * @param String $file Configuration file. * @return void * */ static function setupInit($path = null, $file = null) { Zend_ConfigSettings::setUpConfig(); self::$_general = Zend_Registry::get('general'); self::_setEnv(); }
/** * Sets up our configuration settings depending on environment * will be needed when we want to specify config settings for a * particular situation. ie. needing a diff DB for development. * * @access public * @param String $env Environment used for our tests. * @param String $path Configurations path (relative to working directory). * @param String $file Configuration file name. * */ public static function setUpConfigEnv($env = 'development', $path = '/../../configs', $file = '/environments.ini') { $configPath = self::_setPath($path, $file); self::$_currentEnv = $env; self::_setRegistry($configPath, $env); }