mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Improved performance of CakeFixtureManager.
This commit is contained in:
parent
895f6cac2a
commit
d91059460b
1 changed files with 3 additions and 3 deletions
|
@ -175,7 +175,7 @@ class CakeFixtureManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs the drop and create commands on the fixtures if necessary.
|
* Runs the drop, create and truncate commands on the fixtures if necessary.
|
||||||
*
|
*
|
||||||
* @param CakeTestFixture $fixture the fixture object to create
|
* @param CakeTestFixture $fixture the fixture object to create
|
||||||
* @param DataSource $db the datasource instance to use
|
* @param DataSource $db the datasource instance to use
|
||||||
|
@ -191,6 +191,7 @@ class CakeFixtureManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!empty($fixture->created) && in_array($db->configKeyName, $fixture->created)) {
|
if (!empty($fixture->created) && in_array($db->configKeyName, $fixture->created)) {
|
||||||
|
$fixture->truncate($db);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,6 +206,7 @@ class CakeFixtureManager {
|
||||||
$fixture->create($db);
|
$fixture->create($db);
|
||||||
} else {
|
} else {
|
||||||
$fixture->created[] = $db->configKeyName;
|
$fixture->created[] = $db->configKeyName;
|
||||||
|
$fixture->truncate($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,7 +231,6 @@ class CakeFixtureManager {
|
||||||
$db = ConnectionManager::getDataSource($fixture->useDbConfig);
|
$db = ConnectionManager::getDataSource($fixture->useDbConfig);
|
||||||
$db->begin();
|
$db->begin();
|
||||||
$this->_setupTable($fixture, $db, $test->dropTables);
|
$this->_setupTable($fixture, $db, $test->dropTables);
|
||||||
$fixture->truncate($db);
|
|
||||||
$fixture->insert($db);
|
$fixture->insert($db);
|
||||||
$db->commit();
|
$db->commit();
|
||||||
}
|
}
|
||||||
|
@ -274,7 +275,6 @@ class CakeFixtureManager {
|
||||||
$db = ConnectionManager::getDataSource($fixture->useDbConfig);
|
$db = ConnectionManager::getDataSource($fixture->useDbConfig);
|
||||||
}
|
}
|
||||||
$this->_setupTable($fixture, $db, $dropTables);
|
$this->_setupTable($fixture, $db, $dropTables);
|
||||||
$fixture->truncate($db);
|
|
||||||
$fixture->insert($db);
|
$fixture->insert($db);
|
||||||
} else {
|
} else {
|
||||||
throw new UnexpectedValueException(__d('cake_dev', 'Referenced fixture class %s not found', $name));
|
throw new UnexpectedValueException(__d('cake_dev', 'Referenced fixture class %s not found', $name));
|
||||||
|
|
Loading…
Reference in a new issue