public function testBoolOptions() { $argv = array('./dbpatch.php', 'update', '--force=true', '--skip=false'); $console = new DbPatch_Core_Console($argv); $this->assertTrue($console->getOptionValue('force')); $this->assertFalse($console->getOptionValue('skip')); }
/** * Create dump filename * @return string */ protected function getDumpFilename() { $filename = null; $database = $this->config->db->params->dbname; if ($this->console->issetOption('file')) { $filename = $this->console->getOptionValue('file', null); } if (is_null($filename)) { $filename = $database . '_' . date('Ymd_His') . '.sql'; } if (isset($this->config->dump_directory)) { $filename = $this->trimTrailingSlashes($this->config->dump_directory) . '/' . $filename; } else { $filename = './' . $filename; } return $filename; }
/** * Create dump filename * @return string */ protected function getDumpFilename() { $filename = null; $database = $this->config->db->params->dbname; if ($this->console->issetOption('file')) { $filename = $this->console->getOptionValue('file', null); } if (is_null($filename)) { $filename = $database . '_' . date('Ymd_Hi') . '.sql'; } return $filename; }
/** * Create dump filename * @return string */ protected function getDumpFilename() { $filename = null; $config = $this->getDb()->getAdapter()->getConfig(); $database = $config['dbname']; if ($this->console->issetOption('file')) { $filename = $this->console->getOptionValue('file', null); } if (is_null($filename)) { // split by slash, database name can be a path (in case of SQLite) $parts = explode(DIRECTORY_SEPARATOR, $database); $filename = array_pop($parts) . '_' . date('Ymd_His') . '.sql'; } if (isset($this->config->dump_directory)) { $filename = $this->trimTrailingSlashes($this->config->dump_directory) . '/' . $filename; } else { $filename = './' . $filename; } return $filename; }