Browse Source

Fix coding standards in Datasource tests.

mark_story 14 years ago
parent
commit
346e048371

+ 54 - 60
lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php

@@ -29,6 +29,7 @@ require_once dirname(dirname(dirname(__FILE__))) . DS . 'models.php';
  * @package       Cake.Test.Case.Model.Datasource.Database
  */
 class MysqlTest extends CakeTestCase {
+
 /**
  * autoFixtures property
  *
@@ -267,7 +268,6 @@ class MysqlTest extends CakeTestCase {
 		$this->Dbo->rawQuery('DROP TABLE ' . $name);
 		$this->assertEquals($expected, $result);
 
-
 		$name = $this->Dbo->fullTableName('with_a_key');
 		$this->Dbo->rawQuery('CREATE TABLE ' . $name . ' (id int(11) AUTO_INCREMENT, bool tinyint(1), small_int tinyint(2), primary key(id), KEY `pointless_bool` ( `bool` ));');
 		$expected = array(
@@ -370,8 +370,8 @@ class MysqlTest extends CakeTestCase {
 				'Column_name' => 'id',
 				'Collation' => 'A',
 				'Cardinality' => '0',
-				'Sub_part' => NULL,
-				'Packed' => NULL,
+				'Sub_part' => null,
+				'Packed' => null,
 				'Null' => '',
 				'Index_type' => 'BTREE',
 				'Comment' => ''
@@ -383,9 +383,9 @@ class MysqlTest extends CakeTestCase {
 				'Seq_in_index' => '1',
 				'Column_name' => 'bool',
 				'Collation' => 'A',
-				'Cardinality' => NULL,
-				'Sub_part' => NULL,
-				'Packed' => NULL,
+				'Cardinality' => null,
+				'Sub_part' => null,
+				'Packed' => null,
 				'Null' => 'YES',
 				'Index_type' => 'BTREE',
 				'Comment' => ''
@@ -397,9 +397,9 @@ class MysqlTest extends CakeTestCase {
 				'Seq_in_index' => '1',
 				'Column_name' => 'small_int',
 				'Collation' => 'A',
-				'Cardinality' => NULL,
-				'Sub_part' => NULL,
-				'Packed' => NULL,
+				'Cardinality' => null,
+				'Sub_part' => null,
+				'Packed' => null,
 				'Null' => 'YES',
 				'Index_type' => 'BTREE',
 				'Comment' => ''
@@ -411,9 +411,9 @@ class MysqlTest extends CakeTestCase {
 				'Seq_in_index' => '1',
 				'Column_name' => 'bool',
 				'Collation' => 'A',
-				'Cardinality' => NULL,
-				'Sub_part' => NULL,
-				'Packed' => NULL,
+				'Cardinality' => null,
+				'Sub_part' => null,
+				'Packed' => null,
 				'Null' => 'YES',
 				'Index_type' => 'BTREE',
 				'Comment' => ''
@@ -425,9 +425,9 @@ class MysqlTest extends CakeTestCase {
 				'Seq_in_index' => '2',
 				'Column_name' => 'small_int',
 				'Collation' => 'A',
-				'Cardinality' => NULL,
-				'Sub_part' => NULL,
-				'Packed' => NULL,
+				'Cardinality' => null,
+				'Sub_part' => null,
+				'Packed' => null,
 				'Null' => 'YES',
 				'Index_type' => 'BTREE',
 				'Comment' => ''
@@ -442,7 +442,7 @@ class MysqlTest extends CakeTestCase {
 			->will($this->returnValue($resultMock));
 
 		foreach ($columnData as $i => $data) {
-			$resultMock->expects($this->at($i))->method('fetch')->will($this->returnValue((object) $data));
+			$resultMock->expects($this->at($i))->method('fetch')->will($this->returnValue((object)$data));
 		}
 
 		$result = $mockDbo->index($name, false);
@@ -512,7 +512,7 @@ class MysqlTest extends CakeTestCase {
 		$this->Dbo->cacheSources = $this->Dbo->testing = false;
 		$table = $this->Dbo->fullTableName('altertest');
 
-		$schema1 = new CakeSchema(array(
+		$schemaA = new CakeSchema(array(
 			'name' => 'AlterTest1',
 			'connection' => 'test',
 			'altertest' => array(
@@ -521,7 +521,7 @@ class MysqlTest extends CakeTestCase {
 				'group1' => array('type' => 'integer', 'null' => true),
 				'group2' => array('type' => 'integer', 'null' => true)
 		)));
-		$result = $this->Dbo->createSchema($schema1);
+		$result = $this->Dbo->createSchema($schemaA);
 		$this->assertContains('`id` int(11) DEFAULT 0 NOT NULL,', $result);
 		$this->assertContains('`name` varchar(50) NOT NULL,', $result);
 		$this->assertContains('`group1` int(11) DEFAULT NULL', $result);
@@ -531,7 +531,7 @@ class MysqlTest extends CakeTestCase {
 		$query = $this->Dbo->getConnection()->prepare($result);
 		$this->assertEquals($result, $query->queryString);
 
-		$schema2 = new CakeSchema(array(
+		$schemaB = new CakeSchema(array(
 			'name' => 'AlterTest2',
 			'connection' => 'test',
 			'altertest' => array(
@@ -546,7 +546,7 @@ class MysqlTest extends CakeTestCase {
 					'PRIMARY' => array('column' => 'id', 'unique' => 1))
 		)));
 
-		$result = $this->Dbo->alterSchema($schema2->compare($schema1));
+		$result = $this->Dbo->alterSchema($schemaB->compare($schemaA));
 		$this->assertContains("ALTER TABLE $table", $result);
 		$this->assertContains('ADD KEY name_idx (`name`),', $result);
 		$this->assertContains('ADD KEY group_idx (`group1`),', $result);
@@ -558,7 +558,7 @@ class MysqlTest extends CakeTestCase {
 		$this->assertEquals($result, $query->queryString);
 
 		// Change three indexes, delete one and add another one
-		$schema3 = new CakeSchema(array(
+		$schemaC = new CakeSchema(array(
 			'name' => 'AlterTest3',
 			'connection' => 'test',
 			'altertest' => array(
@@ -573,7 +573,7 @@ class MysqlTest extends CakeTestCase {
 					'id_name_idx' => array('column' => array('id', 'name'), 'unique' => 0))
 		)));
 
-		$result = $this->Dbo->alterSchema($schema3->compare($schema2));
+		$result = $this->Dbo->alterSchema($schemaC->compare($schemaB));
 		$this->assertContains("ALTER TABLE $table", $result);
 		$this->assertContains('DROP PRIMARY KEY,', $result);
 		$this->assertContains('DROP KEY name_idx,', $result);
@@ -588,10 +588,10 @@ class MysqlTest extends CakeTestCase {
 		$this->assertEquals($result, $query->queryString);
 
 		// Compare us to ourself.
-		$this->assertEquals($schema3->compare($schema3), array());
+		$this->assertEquals($schemaC->compare($schemaC), array());
 
 		// Drop the indexes
-		$result = $this->Dbo->alterSchema($schema1->compare($schema3));
+		$result = $this->Dbo->alterSchema($schemaA->compare($schemaC));
 
 		$this->assertContains("ALTER TABLE $table", $result);
 		$this->assertContains('DROP KEY name_idx,', $result);
@@ -628,7 +628,7 @@ class MysqlTest extends CakeTestCase {
 	public function testAlteringTableParameters() {
 		$this->Dbo->cacheSources = $this->Dbo->testing = false;
 
-		$schema1 = new CakeSchema(array(
+		$schemaA = new CakeSchema(array(
 			'name' => 'AlterTest1',
 			'connection' => 'test',
 			'altertest' => array(
@@ -641,8 +641,8 @@ class MysqlTest extends CakeTestCase {
 				)
 			)
 		));
-		$this->Dbo->rawQuery($this->Dbo->createSchema($schema1));
-		$schema2 = new CakeSchema(array(
+		$this->Dbo->rawQuery($this->Dbo->createSchema($schemaA));
+		$schemaB = new CakeSchema(array(
 			'name' => 'AlterTest1',
 			'connection' => 'test',
 			'altertest' => array(
@@ -655,7 +655,7 @@ class MysqlTest extends CakeTestCase {
 				)
 			)
 		));
-		$result = $this->Dbo->alterSchema($schema2->compare($schema1));
+		$result = $this->Dbo->alterSchema($schemaB->compare($schemaA));
 		$this->assertContains('DEFAULT CHARSET=utf8', $result);
 		$this->assertContains('ENGINE=InnoDB', $result);
 		$this->assertContains('COLLATE=utf8_general_ci', $result);
@@ -666,7 +666,7 @@ class MysqlTest extends CakeTestCase {
 		$this->assertEquals($result['Engine'], 'InnoDB');
 		$this->assertEquals($result['charset'], 'utf8');
 
-		$this->Dbo->rawQuery($this->Dbo->dropSchema($schema1));
+		$this->Dbo->rawQuery($this->Dbo->dropSchema($schemaA));
 	}
 
 /**
@@ -828,7 +828,6 @@ class MysqlTest extends CakeTestCase {
 			)
 		));
 
-
 		$this->Dbo->execute($this->Dbo->createSchema($schema));
 		$model = new CakeTestModel(array('table' => 'testdescribes', 'name' => 'Testdescribes'));
 		$result = $model->getDataSource()->describe($model);
@@ -932,7 +931,7 @@ class MysqlTest extends CakeTestCase {
 		$this->assertEquals($result, array('`Article`.`id`'));
 
 		$test->expects($this->at(0))->method('execute')
-			->with('SELECT `Article`.`id` FROM ' . $test->fullTableName('articles'). ' AS `Article`   WHERE 1 = 1');
+			->with('SELECT `Article`.`id` FROM ' . $test->fullTableName('articles') . ' AS `Article`   WHERE 1 = 1');
 
 		$result = $test->read($this->Model, array(
 			'fields' => $this->Model->escapeField(),
@@ -1097,7 +1096,7 @@ class MysqlTest extends CakeTestCase {
  * @param array $data
  * @return array
  */
-	function _scrubQueryData($data) {
+	protected function _scrubQueryData($data) {
 		static $base = null;
 		if ($base === null) {
 			$base = array_fill_keys(array('conditions', 'fields', 'joins', 'order', 'limit', 'offset', 'group'), array());
@@ -1243,7 +1242,7 @@ class MysqlTest extends CakeTestCase {
 		$result = $this->Dbo->generateAssociationQuery($this->Featured2, $null, null, null, null, $queryData, false, $null);
 
 		$this->assertRegExp(
-			'/^SELECT\s+`Featured2`\.`id`, `Featured2`\.`article_id`, `Featured2`\.`category_id`, `Featured2`\.`name`,\s+'.
+			'/^SELECT\s+`Featured2`\.`id`, `Featured2`\.`article_id`, `Featured2`\.`category_id`, `Featured2`\.`name`,\s+' .
 			'`ArticleFeatured2`\.`id`, `ArticleFeatured2`\.`title`, `ArticleFeatured2`\.`user_id`, `ArticleFeatured2`\.`published`\s+' .
 			'FROM\s+\S+`featured2` AS `Featured2`\s+LEFT JOIN\s+\S+`article_featured` AS `ArticleFeatured2`' .
 			'\s+ON\s+\(`ArticleFeatured2`.`published` = \'Y\'\s+AND\s+`Featured2`\.`article_featured2_id` = `ArticleFeatured2`\.`id`\)' .
@@ -1336,7 +1335,7 @@ class MysqlTest extends CakeTestCase {
 
 		$testModel4Table = $this->Dbo->fullTableName($this->Model->TestModel4, true, true);
 		$result = $this->Dbo->buildJoinStatement($queryData['joins'][0]);
-		$expected = ' LEFT JOIN ' .$testModel4Table. ' AS `TestModel4` ON (`TestModel5`.`test_model4_id` = `TestModel4`.`id`)';
+		$expected = ' LEFT JOIN ' . $testModel4Table . ' AS `TestModel4` ON (`TestModel5`.`test_model4_id` = `TestModel4`.`id`)';
 		$this->assertEquals(trim($result), trim($expected));
 
 		$result = $this->Dbo->generateAssociationQuery($this->Model, $null, null, null, null, $queryData, false, $null);
@@ -1368,7 +1367,7 @@ class MysqlTest extends CakeTestCase {
 
 		$testModel4Table = $this->Dbo->fullTableName($this->Model->TestModel4, true, true);
 		$result = $this->Dbo->buildJoinStatement($queryData['joins'][0]);
-		$expected = ' LEFT JOIN ' .$testModel4Table. ' AS `TestModel4` ON (`TestModel5`.`test_model4_id` = `TestModel4`.`id`)';
+		$expected = ' LEFT JOIN ' . $testModel4Table . ' AS `TestModel4` ON (`TestModel5`.`test_model4_id` = `TestModel4`.`id`)';
 		$this->assertEquals(trim($result), trim($expected));
 
 		$result = $this->Dbo->generateAssociationQuery($this->Model, $null, null, null, null, $queryData, false, $null);
@@ -1429,19 +1428,19 @@ class MysqlTest extends CakeTestCase {
 		$result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external'], $resultSet);
 		$this->assertRegExp(
 			'/^SELECT\s+' .
-			'`TestModel6`\.`id`, `TestModel6`\.`test_model5_id`, `TestModel6`\.`name`, `TestModel6`\.`created`, `TestModel6`\.`updated`\s+'.
+			'`TestModel6`\.`id`, `TestModel6`\.`test_model5_id`, `TestModel6`\.`name`, `TestModel6`\.`created`, `TestModel6`\.`updated`\s+' .
 			'FROM\s+\S+`test_model6` AS `TestModel6`\s+WHERE\s+' .
-			'`TestModel6`.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)\s*'.
-			'LIMIT \d*'.
+			'`TestModel6`.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)\s*' .
+			'LIMIT \d*' .
 			'\s*$/', $result
 		);
 
 		$result = $this->Dbo->generateAssociationQuery($this->Model, $null, null, null, null, $queryData, false, $null);
 		$this->assertRegExp(
-			'/^SELECT\s+'.
-			'`TestModel5`\.`id`, `TestModel5`\.`test_model4_id`, `TestModel5`\.`name`, `TestModel5`\.`created`, `TestModel5`\.`updated`\s+'.
-			'FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+'.
-			'(?:\()?\s*1 = 1\s*(?:\))?'.
+			'/^SELECT\s+' .
+			'`TestModel5`\.`id`, `TestModel5`\.`test_model4_id`, `TestModel5`\.`name`, `TestModel5`\.`created`, `TestModel5`\.`updated`\s+' .
+			'FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+' .
+			'(?:\()?\s*1 = 1\s*(?:\))?' .
 			'\s*$/', $result
 		);
 	}
@@ -1484,7 +1483,7 @@ class MysqlTest extends CakeTestCase {
 		$this->Model->schema();
 		$this->_buildRelatedModels($this->Model);
 
-		$__backup = $this->Model->hasMany['TestModel6'];
+		$backup = $this->Model->hasMany['TestModel6'];
 
 		$this->Model->hasMany['TestModel6']['offset'] = 2;
 		$this->Model->hasMany['TestModel6']['limit'] = 5;
@@ -1508,7 +1507,7 @@ class MysqlTest extends CakeTestCase {
 		$this->assertRegExp('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+/', $result);
 		$this->assertRegExp('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result);
 
-		$this->Model->hasMany['TestModel6'] = $__backup;
+		$this->Model->hasMany['TestModel6'] = $backup;
 	}
 
 /**
@@ -1521,7 +1520,7 @@ class MysqlTest extends CakeTestCase {
 		$this->Model->schema();
 		$this->_buildRelatedModels($this->Model);
 
-		$__backup = $this->Model->hasMany['TestModel6'];
+		$backup = $this->Model->hasMany['TestModel6'];
 
 		$this->Model->hasMany['TestModel6']['page'] = 2;
 		$this->Model->hasMany['TestModel6']['limit'] = 5;
@@ -1544,7 +1543,7 @@ class MysqlTest extends CakeTestCase {
 		$this->assertRegExp('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+/', $result);
 		$this->assertRegExp('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result);
 
-		$this->Model->hasMany['TestModel6'] = $__backup;
+		$this->Model->hasMany['TestModel6'] = $backup;
 	}
 
 /**
@@ -1763,7 +1762,7 @@ class MysqlTest extends CakeTestCase {
 		$this->Model->schema();
 		$this->_buildRelatedModels($this->Model);
 
-		$__backup = $this->Model->hasAndBelongsToMany['TestModel7'];
+		$backup = $this->Model->hasAndBelongsToMany['TestModel7'];
 
 		$this->Model->hasAndBelongsToMany['TestModel7']['offset'] = 2;
 		$this->Model->hasAndBelongsToMany['TestModel7']['limit'] = 5;
@@ -1786,7 +1785,7 @@ class MysqlTest extends CakeTestCase {
 		$this->assertRegExp('/^SELECT\s+`TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`\s+/', $result);
 		$this->assertRegExp('/\s+FROM\s+\S+`test_model4` AS `TestModel4`\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result);
 
-		$this->Model->hasAndBelongsToMany['TestModel7'] = $__backup;
+		$this->Model->hasAndBelongsToMany['TestModel7'] = $backup;
 	}
 
 /**
@@ -1799,7 +1798,7 @@ class MysqlTest extends CakeTestCase {
 		$this->Model->schema();
 		$this->_buildRelatedModels($this->Model);
 
-		$__backup = $this->Model->hasAndBelongsToMany['TestModel7'];
+		$backup = $this->Model->hasAndBelongsToMany['TestModel7'];
 
 		$this->Model->hasAndBelongsToMany['TestModel7']['page'] = 2;
 		$this->Model->hasAndBelongsToMany['TestModel7']['limit'] = 5;
@@ -1822,7 +1821,7 @@ class MysqlTest extends CakeTestCase {
 		$this->assertRegExp('/^SELECT\s+`TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`\s+/', $result);
 		$this->assertRegExp('/\s+FROM\s+\S+`test_model4` AS `TestModel4`\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result);
 
-		$this->Model->hasAndBelongsToMany['TestModel7'] = $__backup;
+		$this->Model->hasAndBelongsToMany['TestModel7'] = $backup;
 	}
 
 /**
@@ -1976,7 +1975,6 @@ class MysqlTest extends CakeTestCase {
 		$expected = ' WHERE `Member`.`email` = \'mariano@cricava.com\' AND `Member`.`user` LIKE \'mariano.iglesias%\'';
 		$this->assertEquals($expected, $result);
 
-
 		$result = $this->Dbo->conditions('Member.email = "mariano@cricava.com" AND Member.user LIKE "mariano.iglesias%"');
 		$expected = ' WHERE `Member`.`email` = "mariano@cricava.com" AND `Member`.`user` LIKE "mariano.iglesias%"';
 		$this->assertEquals($expected, $result);
@@ -2125,7 +2123,7 @@ class MysqlTest extends CakeTestCase {
 		$expected = " WHERE MAX(`Post`.`rating`) > '50'";
 		$this->assertEquals($expected, $result);
 
-		$result = $this->Dbo->conditions(array('lower(Article.title)' =>  'secrets'));
+		$result = $this->Dbo->conditions(array('lower(Article.title)' => 'secrets'));
 		$expected = " WHERE lower(`Article`.`title`) = 'secrets'";
 		$this->assertEquals($expected, $result);
 
@@ -2943,13 +2941,12 @@ class MysqlTest extends CakeTestCase {
 
 		$modelTable = $this->Dbo->fullTableName($this->Model);
 		$this->Dbo->expects($this->at(1))->method('execute')
-			->with('SELECT COUNT(`TestModel`.`id`) AS count FROM ' .$modelTable. ' AS `TestModel` WHERE `TestModel`.`name` = \'harry\'');
+			->with('SELECT COUNT(`TestModel`.`id`) AS count FROM ' . $modelTable . ' AS `TestModel` WHERE `TestModel`.`name` = \'harry\'');
 		$this->Dbo->expects($this->at(2))->method('execute')
-			->with('SELECT COUNT(`TestModel`.`id`) AS count FROM ' .$modelTable. ' AS `TestModel` WHERE 1 = 1');
+			->with('SELECT COUNT(`TestModel`.`id`) AS count FROM ' . $modelTable . ' AS `TestModel` WHERE 1 = 1');
 
 		$this->Dbo->hasAny($this->Model, array('TestModel.name' => 'harry'));
 		$this->Dbo->hasAny($this->Model, array());
-
 	}
 
 /**
@@ -3205,7 +3202,7 @@ class MysqlTest extends CakeTestCase {
 
 		$conditions = array('comment_count >' => 2);
 		$query = 'SELECT ' . join(',', $this->Dbo->fields($Article, null, array('id', 'comment_count'))) .
-				' FROM ' .  $this->Dbo->fullTableName($Article) . ' Article ' . $this->Dbo->conditions($conditions, true, true, $Article);
+				' FROM ' . $this->Dbo->fullTableName($Article) . ' Article ' . $this->Dbo->conditions($conditions, true, true, $Article);
 		$result = $this->Dbo->fetchAll($query);
 		$expected = array(array(
 			'Article' => array('id' => 1, 'comment_count' => 4)
@@ -3308,8 +3305,7 @@ class MysqlTest extends CakeTestCase {
 		$data = array(2, 2.2);
 		$this->assertEquals($this->Dbo->introspectType($data), 'integer');
 
-
-		// NULL
+		// null
 		$result = $this->Dbo->value(null, 'boolean');
 		$this->assertEquals($result, 'NULL');
 
@@ -3317,7 +3313,6 @@ class MysqlTest extends CakeTestCase {
 		$result = $this->Dbo->value('', 'boolean');
 		$this->assertEquals($result, "'0'");
 
-
 		// BOOLEAN
 		$result = $this->Dbo->value('true', 'boolean');
 		$this->assertEquals($result, "'1'");
@@ -3519,7 +3514,6 @@ class MysqlTest extends CakeTestCase {
 		$this->Dbo->update($Article, array('field1'), array('value1'));
 		$this->Dbo->update($Article, array('field1'), array('2'), '2=2');
 		$this->Dbo->update($Article, array('field1'), array("'value'"), array('index' => 'val'));
-
 	}
 
 /**

+ 36 - 32
lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php

@@ -56,6 +56,7 @@ class DboPostgresTestDb extends Postgres {
 	public function getLastQuery() {
 		return $this->simulated[count($this->simulated) - 1];
 	}
+
 }
 
 /**
@@ -123,26 +124,27 @@ class PostgresTestModel extends Model {
  */
 	public function schema($field = false) {
 		return array(
-			'id'		=> array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
+			'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
 			'client_id' => array('type' => 'integer', 'null' => '', 'default' => '0', 'length' => '11'),
-			'name'		=> array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
-			'login'		=> array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
-			'passwd'	=> array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
-			'addr_1'	=> array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
-			'addr_2'	=> array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '25'),
-			'zip_code'	=> array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
-			'city'		=> array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
-			'country'	=> array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
-			'phone'		=> array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
-			'fax'		=> array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
-			'url'		=> array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
-			'email'		=> array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
-			'comments'	=> array('type' => 'text', 'null' => '1', 'default' => '', 'length' => ''),
-			'last_login'=> array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''),
-			'created'	=> array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
-			'updated'	=> array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
+			'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
+			'login' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
+			'passwd' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
+			'addr_1' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
+			'addr_2' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '25'),
+			'zip_code' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
+			'city' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
+			'country' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
+			'phone' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
+			'fax' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
+			'url' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
+			'email' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
+			'comments' => array('type' => 'text', 'null' => '1', 'default' => '', 'length' => ''),
+			'last_login' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''),
+			'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
+			'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
 		);
 	}
+
 }
 
 /**
@@ -173,13 +175,14 @@ class PostgresClientTestModel extends Model {
  */
 	public function schema($field = false) {
 		return array(
-			'id'		=> array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8', 'key' => 'primary'),
-			'name'		=> array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
-			'email'		=> array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
-			'created'	=> array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''),
-			'updated'	=> array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
+			'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8', 'key' => 'primary'),
+			'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
+			'email' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
+			'created' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''),
+			'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
 		);
 	}
+
 }
 
 /**
@@ -523,7 +526,7 @@ class PostgresTest extends CakeTestCase {
 		$db1 = ConnectionManager::getDataSource('test');
 		$db1->cacheSources = false;
 
-		$db1->rawQuery('CREATE TABLE ' .  $db1->fullTableName('datatype_tests') . ' (
+		$db1->rawQuery('CREATE TABLE ' . $db1->fullTableName('datatype_tests') . ' (
 			id serial NOT NULL,
 			"varchar" character varying(40) NOT NULL,
 			"full_length" character varying NOT NULL,
@@ -541,12 +544,10 @@ class PostgresTest extends CakeTestCase {
 		$schema->tables = array('datatype_tests' => $result['tables']['missing']['datatype_tests']);
 		$result = $db1->createSchema($schema, 'datatype_tests');
 
-
 		$this->assertNotRegExp('/timestamp DEFAULT/', $result);
 		$this->assertRegExp('/\"full_length\"\s*text\s.*,/', $result);
 		$this->assertRegExp('/timestamp\s*,/', $result);
 
-
 		$db1->query('DROP TABLE ' . $db1->fullTableName('datatype_tests'));
 
 		$db1->query($result);
@@ -731,7 +732,7 @@ class PostgresTest extends CakeTestCase {
 		$this->Dbo->query($this->Dbo->dropSchema($schema1));
 	}
 
-/*
+/**
  * Test it is possible to use virtual field with postgresql
  *
  * @return void
@@ -783,8 +784,11 @@ class PostgresTest extends CakeTestCase {
 	}
 
 /**
-* Test it is possible to do a SELECT COUNT(DISTINCT Model.field) query in postgres and it gets correctly quoted
-*/
+ * Test it is possible to do a SELECT COUNT(DISTINCT Model.field) 
+ * query in postgres and it gets correctly quoted
+ *
+ * @return void
+ */
 	public function testQuoteDistinctInFunction() {
 		$this->loadFixtures('Article');
 		$Article = new Article;
@@ -860,16 +864,16 @@ class PostgresTest extends CakeTestCase {
  */
 	public function testEncoding() {
 		$result = $this->Dbo->setEncoding('UTF8');
-		$this->assertTrue($result) ;
+		$this->assertTrue($result);
 
 		$result = $this->Dbo->getEncoding();
-		$this->assertEquals('UTF8', $result) ;
+		$this->assertEquals('UTF8', $result);
 
 		$result = $this->Dbo->setEncoding('EUC_JP'); /* 'EUC_JP' is right character code name in PostgreSQL */
-		$this->assertTrue($result) ;
+		$this->assertTrue($result);
 
 		$result = $this->Dbo->getEncoding();
-		$this->assertEquals('EUC_JP', $result) ;
+		$this->assertEquals('EUC_JP', $result);
 	}
 
 /**

+ 1 - 0
lib/Cake/Test/Case/Model/Datasource/Database/SqliteTest.php

@@ -55,6 +55,7 @@ class DboSqliteTestDb extends Sqlite {
 	public function getLastQuery() {
 		return $this->simulated[count($this->simulated) - 1];
 	}
+
 }
 
 /**

+ 29 - 23
lib/Cake/Test/Case/Model/Datasource/Database/SqlserverTest.php

@@ -104,6 +104,7 @@ class SqlserverTestDb extends Sqlserver {
 	public function describe($model) {
 		return empty($this->describe) ? parent::describe($model) : $this->describe;
 	}
+
 }
 
 /**
@@ -133,24 +134,24 @@ class SqlserverTestModel extends CakeTestModel {
  * @var array
  */
 	protected $_schema = array(
-		'id'		=> array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8', 'key' => 'primary'),
-		'client_id'	=> array('type' => 'integer', 'null' => '', 'default' => '0', 'length' => '11'),
-		'name'		=> array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
-		'login'		=> array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
-		'passwd'	=> array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
-		'addr_1'	=> array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
-		'addr_2'	=> array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '25'),
-		'zip_code'	=> array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
-		'city'		=> array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
-		'country'	=> array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
-		'phone'		=> array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
-		'fax'		=> array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
-		'url'		=> array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
-		'email'		=> array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
-		'comments'	=> array('type' => 'text', 'null' => '1', 'default' => '', 'length' => ''),
-		'last_login'=> array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''),
-		'created'	=> array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
-		'updated'	=> array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
+		'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8', 'key' => 'primary'),
+		'client_id' => array('type' => 'integer', 'null' => '', 'default' => '0', 'length' => '11'),
+		'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
+		'login' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
+		'passwd' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
+		'addr_1' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
+		'addr_2' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '25'),
+		'zip_code' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
+		'city' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
+		'country' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
+		'phone' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
+		'fax' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
+		'url' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
+		'email' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
+		'comments' => array('type' => 'text', 'null' => '1', 'default' => '', 'length' => ''),
+		'last_login' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''),
+		'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
+		'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
 	);
 
 /**
@@ -176,6 +177,7 @@ class SqlserverTestModel extends CakeTestModel {
 	public function find($conditions = null, $fields = null, $order = null, $recursive = null) {
 		return $conditions;
 	}
+
 }
 
 /**
@@ -184,6 +186,7 @@ class SqlserverTestModel extends CakeTestModel {
  * @package       Cake.Test.Case.Model.Datasource.Database
  */
 class SqlserverClientTestModel extends CakeTestModel {
+
 /**
  * name property
  *
@@ -218,12 +221,14 @@ class SqlserverClientTestModel extends CakeTestModel {
  * @package       Cake.Test.Case.Model.Datasource.Database
  */
 class SqlserverTestResultIterator extends ArrayIterator {
+
 /**
  * closeCursor method
  *
  * @return void
  */
-	public function closeCursor() {}
+	public function closeCursor() {
+	}
 
 /**
  * fetch method
@@ -238,6 +243,7 @@ class SqlserverTestResultIterator extends ArrayIterator {
 		$this->next();
 		return $current;
 	}
+
 }
 
 /**
@@ -408,7 +414,7 @@ class SqlserverTest extends CakeTestCase {
  */
 	public function testDescribe() {
 		$SqlserverTableDescription = new SqlserverTestResultIterator(array(
-			(object) array(
+			(object)array(
 				'Default' => '((0))',
 				'Field' => 'count',
 				'Key' => 0,
@@ -416,7 +422,7 @@ class SqlserverTest extends CakeTestCase {
 				'Null' => 'NO',
 				'Type' => 'integer'
 			),
-			(object) array(
+			(object)array(
 				'Default' => '',
 				'Field' => 'body',
 				'Key' => 0,
@@ -424,7 +430,7 @@ class SqlserverTest extends CakeTestCase {
 				'Null' => 'YES',
 				'Type' => 'nvarchar'
 			),
-			(object) array(
+			(object)array(
 				'Default' => '',
 				'Field' => 'published',
 				'Key' => 0,
@@ -433,7 +439,7 @@ class SqlserverTest extends CakeTestCase {
 				'Null' => 'YES',
 				'Size' => ''
 			),
-			(object) array(
+			(object)array(
 				'Default' => '',
 				'Field' => 'id',
 				'Key' => 1,