mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-02-07 12:36:25 +00:00
Making CakeSchema tests pass
This commit is contained in:
parent
be83288806
commit
cd28f19363
2 changed files with 8 additions and 5 deletions
|
@ -219,19 +219,21 @@ class CakeSchema extends Object {
|
||||||
|
|
||||||
if (!is_array($models) && $models !== false) {
|
if (!is_array($models) && $models !== false) {
|
||||||
if (isset($this->plugin)) {
|
if (isset($this->plugin)) {
|
||||||
$models = App::objects('model', App::pluginPath($this->plugin) . 'models' . DS, false);
|
$models = App::objects($this->plugin . '.Model', null, false);
|
||||||
} else {
|
} else {
|
||||||
$models = App::objects('model');
|
$models = App::objects('Model');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($models)) {
|
if (is_array($models)) {
|
||||||
foreach ($models as $model) {
|
foreach ($models as $model) {
|
||||||
$importModel = $model;
|
$importModel = $model;
|
||||||
|
$plugin = null;
|
||||||
if (isset($this->plugin)) {
|
if (isset($this->plugin)) {
|
||||||
$importModel = $this->plugin . '.' . $model;
|
$importModel = $model;
|
||||||
|
$plugin = $this->plugin . '.';
|
||||||
}
|
}
|
||||||
App::uses($importModel, 'Model');
|
App::uses($importModel, $plugin . 'Model');
|
||||||
if (!class_exists($importModel)) {
|
if (!class_exists($importModel)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
App::uses('CakeSchema', 'Model');
|
App::uses('CakeSchema', 'Model');
|
||||||
|
App::uses('CakeTestFixture', 'TestSuite/Fixture');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for Schema database management
|
* Test for Schema database management
|
||||||
|
@ -632,7 +633,7 @@ class CakeSchemaTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function testSchemaReadWithConfigPrefix() {
|
function testSchemaReadWithConfigPrefix() {
|
||||||
$db =& ConnectionManager::getDataSource('test');
|
$db = ConnectionManager::getDataSource('test');
|
||||||
$config = $db->config;
|
$config = $db->config;
|
||||||
$config['prefix'] = 'schema_test_prefix_';
|
$config['prefix'] = 'schema_test_prefix_';
|
||||||
ConnectionManager::create('schema_prefix', $config);
|
ConnectionManager::create('schema_prefix', $config);
|
||||||
|
|
Loading…
Add table
Reference in a new issue