Fixing issue where fixtures without field definitions would drop tables,

even though they had no way to re-create them. Fixes #1519
This commit is contained in:
mark_story 2011-02-08 21:53:12 -05:00
parent 9a940709ab
commit a5fb2cf8a7
2 changed files with 7 additions and 0 deletions

View file

@ -391,6 +391,10 @@ class CakeTestFixtureTest extends CakeTestCase {
$this->criticDb->setReturnValueAt(1, 'execute', false);
$return = $Fixture->drop($this->criticDb);
$this->assertFalse($return);
unset($Fixture->fields);
$return = $Fixture->drop($this->criticDb);
$this->assertFalse($return);
}
/**

View file

@ -153,6 +153,9 @@ class CakeTestFixture extends Object {
* @access public
*/
function drop(&$db) {
if (empty($this->fields)) {
return false;
}
$this->Schema->_build(array($this->table => $this->fields));
return (
$db->execute($db->dropSchema($this->Schema), array('log' => false)) !== false