mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-02-12 06:56:24 +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);
|
$this->criticDb->setReturnValueAt(1, 'execute', false);
|
||||||
$return = $Fixture->drop($this->criticDb);
|
$return = $Fixture->drop($this->criticDb);
|
||||||
$this->assertFalse($return);
|
$this->assertFalse($return);
|
||||||
|
|
||||||
|
unset($Fixture->fields);
|
||||||
|
$return = $Fixture->drop($this->criticDb);
|
||||||
|
$this->assertFalse($return);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -153,6 +153,9 @@ class CakeTestFixture extends Object {
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function drop(&$db) {
|
function drop(&$db) {
|
||||||
|
if (empty($this->fields)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$this->Schema->_build(array($this->table => $this->fields));
|
$this->Schema->_build(array($this->table => $this->fields));
|
||||||
return (
|
return (
|
||||||
$db->execute($db->dropSchema($this->Schema), array('log' => false)) !== false
|
$db->execute($db->dropSchema($this->Schema), array('log' => false)) !== false
|
||||||
|
|
Loading…
Add table
Reference in a new issue