mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
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:
parent
9a940709ab
commit
a5fb2cf8a7
2 changed files with 7 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue