protected function setUp() { require RUCKUSING_BASE . '/config/database.inc.php'; if (!is_array($ruckusing_db_config) || !array_key_exists("test", $ruckusing_db_config)) { die("\n'test' DB is not defined in config/database.inc.php\n\n"); } $test_db = $ruckusing_db_config['test']; //setup our log $logger = Ruckusing_Logger::instance(RUCKUSING_BASE . '/tests/logs/test.log'); $this->adapter = new Ruckusing_MySQLAdapter($test_db, $logger); $this->adapter->logger->log("Test run started: " . date('Y-m-d g:ia T')); }
protected function setUp() { global $ruckusing_db_config; if (!is_array($ruckusing_db_config) || !array_key_exists("test", $ruckusing_db_config)) { die("\n'test' DB is not defined in config/database.inc.php\n\n"); } $test_db = $ruckusing_db_config['test']; //setup our log $logger = Ruckusing_Logger::instance(RUCKUSING_BASE . '/tests/logs/test.log'); $this->adapter = new Ruckusing_MySQLAdapter($test_db, $logger); $this->adapter->logger->log("Test run started: " . date('Y-m-d g:ia T')); //create the schema table if necessary $this->adapter->create_schema_version_table(); }
protected function setUp() { $ruckusing_config = (require RUCKUSING_BASE . '/config/database.inc.php'); if (!is_array($ruckusing_config) || !(array_key_exists("db", $ruckusing_config) && array_key_exists("test", $ruckusing_config['db']))) { die("\n'test' DB is not defined in config/database.inc.php\n\n"); } $test_db = $ruckusing_config['db']['test']; //setup our log $logger = Ruckusing_Logger::instance(RUCKUSING_BASE . '/tests/logs/test.log'); $this->adapter = new Ruckusing_MySQLAdapter($test_db, $logger); $this->adapter->logger->log("Test run started: " . date('Y-m-d g:ia T')); //create the schema table if necessary $this->adapter->create_schema_version_table(); $framework = new Ruckusing_FrameworkRunner($ruckusing_config, null); $this->migrations_dir = $framework->migrations_directory(); if (!is_dir($this->migrations_dir)) { mkdir($this->migrations_dir); } }
function __construct($db, $argv) { try { set_error_handler(array("Ruckusing_FrameworkRunner", "scr_error_handler"), E_ALL); //parse arguments $this->parse_args($argv); //initialize logger $log_dir = RUCKUSING_BASE . "/logs"; if (is_dir($log_dir) && !is_writable($log_dir)) { die("\n\nCannot write to log directory: {$log_dir}\n\nCheck permissions.\n\n"); } elseif (!is_dir($log_dir)) { //try and create the log directory mkdir($log_dir); } $log_name = sprintf("%s.log", $this->ENV); $this->logger =& Ruckusing_Logger::instance($log_dir . "/" . $log_name); //include all adapters $this->load_all_adapters(RUCKUSING_BASE . '/lib/classes/adapters'); $this->db_config = $db; $this->initialize_db(); $this->init_tasks(); } catch (Exception $e) { } }