From f215cd01f19102d23de42eb0f762397731934015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Lorenzo=20Rodr=C3=ADguez?= Date: Sun, 17 Oct 2010 15:25:04 -0430 Subject: [PATCH] Fixing tests for CakeSchema --- .../cases/libs/model/cake_schema.test.php | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/cake/tests/cases/libs/model/cake_schema.test.php b/cake/tests/cases/libs/model/cake_schema.test.php index 0be67982d..d9cc0978e 100644 --- a/cake/tests/cases/libs/model/cake_schema.test.php +++ b/cake/tests/cases/libs/model/cake_schema.test.php @@ -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'),