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("sqlite_test", $ruckusing_config['db']))) {
         $this->markTestSkipped("\n'sqlite_test' DB is not defined in config/database.inc.php\n\n");
     }
     $test_db = $ruckusing_config['db']['sqlite_test'];
     //setup our log
     $logger = Ruckusing_Util_Logger::instance(RUCKUSING_BASE . '/tests/logs/test.log');
     $this->adapter = new Ruckusing_Adapter_Sqlite3_Base($test_db, $logger);
     $this->adapter->logger->log("Test run started: " . date('Y-m-d g:ia T'));
 }
 /**
  * Setup commands before test case
  */
 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("mysql_test", $ruckusing_config['db']))) {
         $this->markTestSkipped("\n'mysql_test' DB is not defined in config/database.inc.php\n\n");
     }
     $test_db = $ruckusing_config['db']['mysql_test'];
     //setup our log
     $logger = Ruckusing_Util_Logger::instance(RUCKUSING_BASE . '/tests/logs/test.log');
     $this->adapter = new Ruckusing_Adapter_MySQL_Base($test_db, $logger);
     $this->adapter->logger->log("Test run started: " . date('Y-m-d g:ia T'));
     $this->framework = new Ruckusing_FrameworkRunner($ruckusing_config, array('ENV=mysql_test'));
     $this->db_dir = $this->framework->db_directory();
     if (!is_dir($this->db_dir)) {
         mkdir($this->db_dir, 0755, true);
     }
 }
 /**
  * Setup commands before test case
  */
 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("mysql_test", $ruckusing_config['db']))) {
         $this->markTestSkipped("\n'mysql_test' DB is not defined in config/database.inc.php\n\n");
     }
     $test_db = $ruckusing_config['db']['mysql_test'];
     //setup our log
     $logger = Ruckusing_Util_Logger::instance(RUCKUSING_BASE . '/tests/logs/test.log');
     $this->adapter = new Ruckusing_Adapter_MySQL_Base($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, array('ENV=mysql_test', 'module=default'));
     $this->migrations_dirs = $framework->migrations_directories();
     // need to deal with array, not just string at main
     if (!is_dir($this->migrations_dirs['default'])) {
         mkdir($this->migrations_dirs['default'], 0755, true);
     }
 }
 /**
  * Setup commands before test case
  */
 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("mysql_test", $ruckusing_config['db']))) {
         $this->markTestSkipped("\n'mysql_test' DB is not defined in config/database.inc.php\n\n");
     }
     $test_db = $ruckusing_config['db']['mysql_test'];
     //setup our log
     $logger = Ruckusing_Util_Logger::instance(RUCKUSING_BASE . '/tests/logs/test.log');
     $this->adapter = new Ruckusing_Adapter_MySQL_Base($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, array('ENV=mysql_test'));
     $this->migrations_dirs = $framework->migrations_directories();
     // additional path addede here - because of non-changing main config file for useless dir
     $this->migrations_dirs['additional'] = RUCKUSING_WORKING_BASE . '/migrations/second_test_dir';
     // need to deal with array, not just string at main
     foreach ($this->migrations_dirs as $key => $dir) {
         if (!is_dir($dir)) {
             mkdir($dir, 0755, true);
         }
     }
 }
Example #5
0
 /**
  * Close the log file handler
  */
 public function close()
 {
     if ($this->_fp) {
         $closed = fclose($this->_fp);
         if ($closed) {
             $this->_fp = null;
             self::$_instance = null;
         } else {
             throw new Ruckusing_Exception('Error closing the log file', Ruckusing_Exception::INVALID_LOG);
         }
     }
 }
 /**
  * Initialize the logger
  */
 public function initialize_logger()
 {
     if (!$this->logger) {
         if (is_dir($this->_config['log_dir']) && !is_writable($this->_config['log_dir'])) {
             throw new Ruckusing_Exception("\n\nCannot write to log directory: " . $this->_config['log_dir'] . "\n\nCheck permissions.\n\n", Ruckusing_Exception::INVALID_LOG);
         } elseif (!is_dir($this->_config['log_dir'])) {
             //try and create the log directory
             mkdir($this->_config['log_dir'], 0755, true);
         }
         $log_name = sprintf("%s.log", $this->_env);
         $this->logger = Ruckusing_Util_Logger::instance($this->_config['log_dir'] . DIRECTORY_SEPARATOR . $log_name);
     }
 }