mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fixing missing table errors on model imports. Fixed broken test. Fixes #5877
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7916 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
43af288eca
commit
3682c9c6ae
2 changed files with 4 additions and 3 deletions
|
@ -201,7 +201,7 @@ class CakeTestFixtureTest extends CakeTestCase {
|
|||
|
||||
$Fixture =& new CakeTestFixtureDefaultImportFixture();
|
||||
$Fixture->fields = $Fixture->records = null;
|
||||
$Fixture->import = 'FixtureImportTestModel';
|
||||
$Fixture->import = array('model' => 'FixtureImportTestModel', 'connection' => 'new_test_suite');
|
||||
$Fixture->init();
|
||||
$this->assertEqual(array_keys($Fixture->fields), array('id', 'name', 'created'));
|
||||
|
||||
|
|
|
@ -67,11 +67,13 @@ class CakeTestFixture extends Object {
|
|||
$import = array_merge(array('connection' => 'default', 'records' => false), is_array($this->import) ? $this->import : array('model' => $this->import));
|
||||
|
||||
if (isset($import['model']) && App::import('Model', $import['model'])) {
|
||||
$model =& ClassRegistry::init(array('class' => $import['model'], 'ds' => $import['connection']));
|
||||
ClassRegistry::config(array('ds' => $import['connection']));
|
||||
$model =& ClassRegistry::init($import['model']);
|
||||
$db =& ConnectionManager::getDataSource($model->useDbConfig);
|
||||
$db->cacheSources = false;
|
||||
$this->fields = $model->schema(true);
|
||||
$this->fields[$model->primaryKey]['key'] = 'primary';
|
||||
ClassRegistry::config(array('ds' => 'test_suite'));
|
||||
ClassRegistry::flush();
|
||||
} elseif (isset($import['table'])) {
|
||||
$model =& new Model(null, $import['table'], $import['connection']);
|
||||
|
@ -86,7 +88,6 @@ class CakeTestFixture extends Object {
|
|||
|
||||
if (isset($import['records']) && $import['records'] !== false && isset($model) && isset($db)) {
|
||||
$this->records = array();
|
||||
|
||||
$query = array(
|
||||
'fields' => array_keys($this->fields),
|
||||
'table' => $db->fullTableName($model->table),
|
||||
|
|
Loading…
Reference in a new issue