Permalink
Browse files

Fixing issue where fixtures without field definitions would drop tables,

even though they had no way to re-create them. Fixes #1519
  • Loading branch information...
1 parent 9a94070 commit a5fb2cf8a73ca5f6095a4b271751ac1488f1f0fe @markstory markstory committed Feb 9, 2011
Showing with 7 additions and 0 deletions.
  1. +4 −0 cake/tests/cases/libs/cake_test_fixture.test.php
  2. +3 −0 cake/tests/lib/cake_test_fixture.php
@@ -391,6 +391,10 @@ function testDrop() {
$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);
}
/**
@@ -153,6 +153,9 @@ function create(&$db) {
* @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

0 comments on commit a5fb2cf

Please sign in to comment.