Created
July 15, 2009 08:51
-
-
Save k1LoW/147586 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Runs as first test to create tables. | |
* | |
* @return void | |
* @access public | |
*/ | |
function start() { | |
if (isset($this->_fixtures) && isset($this->db)) { | |
Configure::write('Cache.disable', true); | |
$cacheSources = $this->db->cacheSources; | |
$this->db->cacheSources = false; | |
$sources = $this->db->listSources(); | |
$this->db->cacheSources = $cacheSources; | |
if (!$this->dropTables) { | |
return; | |
} | |
foreach ($this->_fixtures as $fixture) { | |
if ($this->db->_baseConfig['connect'] == 'pg_connect' || $this->db->_baseConfig['connect'] == 'pg_pconnect') { | |
$table = $this->db->config['prefix'] . $fixture->table; | |
} | |
if (in_array($table, $sources)) { | |
$fixture->drop($this->db); | |
$fixture->create($this->db); | |
} elseif (!in_array($table, $sources)) { | |
$fixture->create($this->db); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment