mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge branch 'master' into 2.4
This commit is contained in:
commit
026df62a1f
3 changed files with 10 additions and 3 deletions
|
@ -53,6 +53,8 @@ class SchemaShell extends AppShell {
|
||||||
$this->out('Cake Schema Shell');
|
$this->out('Cake Schema Shell');
|
||||||
$this->hr();
|
$this->hr();
|
||||||
|
|
||||||
|
Configure::write('Cache.disable', 1);
|
||||||
|
|
||||||
$name = $path = $connection = $plugin = null;
|
$name = $path = $connection = $plugin = null;
|
||||||
if (!empty($this->params['name'])) {
|
if (!empty($this->params['name'])) {
|
||||||
$name = $this->params['name'];
|
$name = $this->params['name'];
|
||||||
|
|
|
@ -43,7 +43,11 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
|
||||||
public $autoFixtures = true;
|
public $autoFixtures = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Control table create/drops on each test method.
|
||||||
|
*
|
||||||
* Set this to false to avoid tables to be dropped if they already exist
|
* Set this to false to avoid tables to be dropped if they already exist
|
||||||
|
* between each test method. Tables will still be dropped at the
|
||||||
|
* end of each test runner execution.
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
|
@ -205,7 +209,7 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
|
||||||
}
|
}
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
foreach ($args as $class) {
|
foreach ($args as $class) {
|
||||||
$this->fixtureManager->loadSingle($class);
|
$this->fixtureManager->loadSingle($class, null, $this->dropTables);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -243,17 +243,18 @@ class CakeFixtureManager {
|
||||||
*
|
*
|
||||||
* @param string $name of the fixture
|
* @param string $name of the fixture
|
||||||
* @param DataSource $db DataSource instance or leave null to get DataSource from the fixture
|
* @param DataSource $db DataSource instance or leave null to get DataSource from the fixture
|
||||||
|
* @param boolean $dropTables Whether or not tables should be dropped and re-created.
|
||||||
* @return void
|
* @return void
|
||||||
* @throws UnexpectedValueException if $name is not a previously loaded class
|
* @throws UnexpectedValueException if $name is not a previously loaded class
|
||||||
*/
|
*/
|
||||||
public function loadSingle($name, $db = null) {
|
public function loadSingle($name, $db = null, $dropTables = true) {
|
||||||
$name .= 'Fixture';
|
$name .= 'Fixture';
|
||||||
if (isset($this->_fixtureMap[$name])) {
|
if (isset($this->_fixtureMap[$name])) {
|
||||||
$fixture = $this->_fixtureMap[$name];
|
$fixture = $this->_fixtureMap[$name];
|
||||||
if (!$db) {
|
if (!$db) {
|
||||||
$db = ConnectionManager::getDataSource($fixture->useDbConfig);
|
$db = ConnectionManager::getDataSource($fixture->useDbConfig);
|
||||||
}
|
}
|
||||||
$this->_setupTable($fixture, $db);
|
$this->_setupTable($fixture, $db, $dropTables);
|
||||||
$fixture->truncate($db);
|
$fixture->truncate($db);
|
||||||
$fixture->insert($db);
|
$fixture->insert($db);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue