mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Fixing tests for CakeSchema
This commit is contained in:
parent
cbdfb3f76e
commit
f215cd01f1
1 changed files with 12 additions and 11 deletions
|
@ -210,7 +210,7 @@ class TestAppSchema extends CakeSchema {
|
|||
*/
|
||||
public $datatypes = array(
|
||||
'id' => array('type' => 'integer', 'null' => false, 'default' => 0, 'key' => 'primary'),
|
||||
'float_field' => array('type' => 'float', 'null' => false, 'length' => '5,2', 'default' => ''),
|
||||
'float_field' => array('type' => 'float', 'null' => false, 'length' => '5,2', 'default' => '', 'collate' => null, 'comment' => null),
|
||||
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => true)),
|
||||
'tableParameters' => array()
|
||||
);
|
||||
|
@ -523,6 +523,7 @@ class CakeSchemaTest extends CakeTestCase {
|
|||
*/
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
ConnectionManager::getDataSource('test')->cacheSources = false;
|
||||
$this->Schema = new TestAppSchema();
|
||||
}
|
||||
|
||||
|
@ -581,14 +582,14 @@ class CakeSchemaTest extends CakeTestCase {
|
|||
$this->Schema->tables['datatypes']['float_field']
|
||||
);
|
||||
|
||||
$db =& ConnectionManager::getDataSource('test');
|
||||
$db = ConnectionManager::getDataSource('test');
|
||||
$config = $db->config;
|
||||
$config['prefix'] = 'schema_test_prefix_';
|
||||
ConnectionManager::create('schema_prefix', $config);
|
||||
$read = $this->Schema->read(array('connection' => 'schema_prefix', 'models' => false));
|
||||
$this->assertTrue(empty($read['tables']));
|
||||
|
||||
$SchemaPost =& ClassRegistry::init('SchemaPost');
|
||||
$SchemaPost = ClassRegistry::init('SchemaPost');
|
||||
$SchemaPost->table = 'sts';
|
||||
$SchemaPost->tablePrefix = 'po';
|
||||
$read = $this->Schema->read(array(
|
||||
|
@ -612,9 +613,9 @@ class CakeSchemaTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testSchemaReadWithTablePrefix() {
|
||||
$model =& new SchemaPrefixAuthUser();
|
||||
$model = new SchemaPrefixAuthUser();
|
||||
|
||||
$Schema =& new CakeSchema();
|
||||
$Schema = new CakeSchema();
|
||||
$read = $Schema->read(array(
|
||||
'connection' => 'test',
|
||||
'name' => 'TestApp',
|
||||
|
@ -636,7 +637,7 @@ class CakeSchemaTest extends CakeTestCase {
|
|||
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
|
||||
));
|
||||
|
||||
$Schema =& new CakeSchema();
|
||||
$Schema = new CakeSchema();
|
||||
$Schema->plugin = 'TestPlugin';
|
||||
$read = $Schema->read(array(
|
||||
'connection' => 'test',
|
||||
|
@ -670,7 +671,7 @@ class CakeSchemaTest extends CakeTestCase {
|
|||
return;
|
||||
}
|
||||
|
||||
$db2 =& ConnectionManager::getDataSource('test2');
|
||||
$db2 = ConnectionManager::getDataSource('test2');
|
||||
$fixture = new SchemaCrossDatabaseFixture();
|
||||
$fixture->create($db2);
|
||||
$fixture->insert($db2);
|
||||
|
@ -910,7 +911,7 @@ class CakeSchemaTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testSchemaLoading() {
|
||||
$Other =& $this->Schema->load(array('name' => 'MyOtherApp', 'path' => TMP . 'tests'));
|
||||
$Other = $this->Schema->load(array('name' => 'MyOtherApp', 'path' => TMP . 'tests'));
|
||||
$this->assertEqual($Other->name, 'MyOtherApp');
|
||||
$this->assertEqual($Other->tables, $this->Schema->tables);
|
||||
}
|
||||
|
@ -924,7 +925,7 @@ class CakeSchemaTest extends CakeTestCase {
|
|||
App::build(array(
|
||||
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
|
||||
));
|
||||
$Other =& $this->Schema->load(array('name' => 'TestPluginApp', 'plugin' => 'TestPlugin'));
|
||||
$Other = $this->Schema->load(array('name' => 'TestPluginApp', 'plugin' => 'TestPlugin'));
|
||||
$this->assertEqual($Other->name, 'TestPluginApp');
|
||||
$this->assertEqual(array_keys($Other->tables), array('acos'));
|
||||
|
||||
|
@ -938,10 +939,10 @@ class CakeSchemaTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testSchemaCreateTable() {
|
||||
$db =& ConnectionManager::getDataSource('test');
|
||||
$db = ConnectionManager::getDataSource('test');
|
||||
$db->cacheSources = false;
|
||||
|
||||
$Schema =& new CakeSchema(array(
|
||||
$Schema = new CakeSchema(array(
|
||||
'connection' => 'test',
|
||||
'testdescribes' => array(
|
||||
'id' => array('type' => 'integer', 'key' => 'primary'),
|
||||
|
|
Loading…
Reference in a new issue