Browse Source

Fix more coding standards.

mark_story 14 years ago
parent
commit
dbb2dd44d7

+ 2 - 1
lib/Cake/Test/Case/Model/AclNodeTest.php

@@ -198,6 +198,7 @@ class DbAroUserTest extends CakeTestModel {
 			return array('DbAroTest' => array('DbAroTest.model' => 'AuthUser', 'DbAroTest.foreign_key' => 2));
 		}
 	}
+
 }
 
 /**
@@ -218,6 +219,7 @@ class TestDbAcl extends DbAcl {
 		$this->Aco = new DbAcoTest();
 		$this->Aro->Permission = new DbPermissionTest();
 	}
+
 }
 
 /**
@@ -332,7 +334,6 @@ class AclNodeTest extends CakeTestCase {
 		$result = Set::extract($Aro->node($Model), '{n}.DbAroTest.id');
 		$expected = array(4, 2, 1);
 		$this->assertEquals($expected, $result);
-
 	}
 
 /**

+ 13 - 66
lib/Cake/Test/Case/Model/BehaviorCollectionTest.php

@@ -320,6 +320,7 @@ class TestBehavior extends ModelBehavior {
 		$query = preg_replace('/^in\s+/', 'Location.name = \'', $query);
 		return $method . '\' AND ' . $query . '\'';
 	}
+
 }
 
 /**
@@ -328,15 +329,15 @@ class TestBehavior extends ModelBehavior {
  * @package       Cake.Test.Case.Model
  */
 class Test2Behavior extends TestBehavior {
+
 	public $mapMethods = array('/mappingRobot(\w+)/' => 'mapped');
 
 	public function resolveMethod(Model $model, $stuff) {
-
 	}
 
 	public function mapped(Model $model, $method, $query) {
-
 	}
+
 }
 
 /**
@@ -353,11 +354,13 @@ class Test3Behavior extends TestBehavior{
  * @package       Cake.Test.Case.Model
  */
 class Test4Behavior extends ModelBehavior{
+
 	public function setup(Model $model, $config = null) {
 		$model->bindModel(
 			array('hasMany' => array('Comment'))
 		);
 	}
+
 }
 
 /**
@@ -366,11 +369,13 @@ class Test4Behavior extends ModelBehavior{
  * @package       Cake.Test.Case.Model
  */
 class Test5Behavior extends ModelBehavior{
+
 	public function setup(Model $model, $config = null) {
 		$model->bindModel(
 			array('belongsTo' => array('User'))
 		);
 	}
+
 }
 
 /**
@@ -379,11 +384,13 @@ class Test5Behavior extends ModelBehavior{
  * @package       Cake.Test.Case.Model
  */
 class Test6Behavior extends ModelBehavior{
+
 	public function setup(Model $model, $config = null) {
 		$model->bindModel(
 			array('hasAndBelongsToMany' => array('Tag'))
 		);
 	}
+
 }
 
 /**
@@ -392,11 +399,13 @@ class Test6Behavior extends ModelBehavior{
  * @package       Cake.Test.Case.Model
  */
 class Test7Behavior extends ModelBehavior{
+
 	public function setup(Model $model, $config = null) {
 		$model->bindModel(
 			array('hasOne' => array('Attachment'))
 		);
 	}
+
 }
 
 /**
@@ -693,14 +702,12 @@ class BehaviorCollectionTest extends CakeTestCase {
 
 		$Apple->Child->Behaviors->attach('Test', array('before' => 'modify'));
 		$result = $Apple->find('all', array('fields' => array('Apple.id'), 'conditions' => array('Apple.id <' => '4')));
-		//$this->assertEquals($expected, $result2);
 
 		$Apple->Child->Behaviors->disable('Test');
 		$result = $Apple->find('all');
 		$this->assertEquals($expected, $result);
 
 		$Apple->Child->Behaviors->attach('Test', array('before' => 'off', 'after' => 'on'));
-		//$this->assertSame($Apple->find('all'), array());
 
 		$Apple->Child->Behaviors->attach('Test', array('after' => 'off'));
 		$this->assertEquals($Apple->find('all'), $expected);
@@ -710,21 +717,9 @@ class BehaviorCollectionTest extends CakeTestCase {
 
 		$Apple->Child->Behaviors->attach('Test', array('after' => 'test2'));
 		$this->assertEquals($Apple->find('all'), $expected);
-
-		$Apple->Child->Behaviors->attach('Test', array('after' => 'modify'));
-		$expected = array(
-			array('id' => '1', 'apple_id' => '2', 'color' => 'Red 1', 'name' => 'Red Apple 1', 'created' => '2006-11-22 10:38:58', 'date' => '1951-01-04', 'modified' => '2006-12-01 13:31:26', 'mytime' => '22:57:17'),
-			array('id' => '2', 'apple_id' => '1', 'color' => 'Bright Red 1', 'name' => 'Bright Red Apple', 'created' => '2006-11-22 10:43:13', 'date' => '2014-01-01', 'modified' => '2006-11-30 18:38:10', 'mytime' => '22:57:17'),
-			array('id' => '3', 'apple_id' => '2', 'color' => 'blue green', 'name' => 'green blue', 'created' => '2006-12-25 05:13:36', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:23:24', 'mytime' => '22:57:17'),
-			array('id' => '4', 'apple_id' => '2', 'color' => 'Blue Green', 'name' => 'Test Name', 'created' => '2006-12-25 05:23:36', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:23:36', 'mytime' => '22:57:17'),
-			array('id' => '5', 'apple_id' => '5', 'color' => 'Green', 'name' => 'Blue Green', 'created' => '2006-12-25 05:24:06', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:29:16', 'mytime' => '22:57:17'),
-			array('id' => '6', 'apple_id' => '4', 'color' => 'My new appleOrange', 'name' => 'My new apple', 'created' => '2006-12-25 05:29:39', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:29:39', 'mytime' => '22:57:17'),
-			array('id' => '7', 'apple_id' => '6', 'color' => 'Some wierd color', 'name' => 'Some odd color', 'created' => '2006-12-25 05:34:21', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:34:21', 'mytime' => '22:57:17')
-		);
-		//$this->assertEquals($Apple->find('all'), $expected);
-
 	}
-	/**
+
+/**
  * testBehaviorHasOneFindCallbacks method
  *
  * @return void
@@ -746,32 +741,10 @@ class BehaviorCollectionTest extends CakeTestCase {
 		$Apple->Sample->Behaviors->attach('Test', array('before' => 'test'));
 		$this->assertSame($Apple->find('all'), $expected);
 
-		$Apple->Sample->Behaviors->attach('Test', array('before' => 'modify'));
-		$expected2 = array(
-			array(
-				'Apple' => array('id' => 1),
-				'Child' => array(
-					array('id' => 2, 'name' => 'Bright Red Apple', 'mytime' => '22:57:17'))),
-			array(
-				'Apple' => array('id' => 2),
-				'Child' => array(
-					array('id' => 1, 'name' => 'Red Apple 1', 'mytime' => '22:57:17'),
-					array('id' => 3, 'name' => 'green blue', 'mytime' => '22:57:17'),
-					array('id' => 4, 'name' => 'Test Name', 'mytime' => '22:57:17'))),
-			array(
-				'Apple' => array('id' => 3),
-				'Child' => array())
-		);
-		$result = $Apple->find('all', array('fields' => array('Apple.id'), 'conditions' => array('Apple.id <' => '4')));
-		//$this->assertEquals($expected, $result2);
-
 		$Apple->Sample->Behaviors->disable('Test');
 		$result = $Apple->find('all');
 		$this->assertEquals($expected, $result);
 
-		$Apple->Sample->Behaviors->attach('Test', array('before' => 'off', 'after' => 'on'));
-		//$this->assertSame($Apple->find('all'), array());
-
 		$Apple->Sample->Behaviors->attach('Test', array('after' => 'off'));
 		$this->assertEquals($Apple->find('all'), $expected);
 
@@ -780,18 +753,6 @@ class BehaviorCollectionTest extends CakeTestCase {
 
 		$Apple->Sample->Behaviors->attach('Test', array('after' => 'test2'));
 		$this->assertEquals($Apple->find('all'), $expected);
-
-		$Apple->Sample->Behaviors->attach('Test', array('after' => 'modify'));
-		$expected = array(
-			array('id' => '1', 'apple_id' => '2', 'color' => 'Red 1', 'name' => 'Red Apple 1', 'created' => '2006-11-22 10:38:58', 'date' => '1951-01-04', 'modified' => '2006-12-01 13:31:26', 'mytime' => '22:57:17'),
-			array('id' => '2', 'apple_id' => '1', 'color' => 'Bright Red 1', 'name' => 'Bright Red Apple', 'created' => '2006-11-22 10:43:13', 'date' => '2014-01-01', 'modified' => '2006-11-30 18:38:10', 'mytime' => '22:57:17'),
-			array('id' => '3', 'apple_id' => '2', 'color' => 'blue green', 'name' => 'green blue', 'created' => '2006-12-25 05:13:36', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:23:24', 'mytime' => '22:57:17'),
-			array('id' => '4', 'apple_id' => '2', 'color' => 'Blue Green', 'name' => 'Test Name', 'created' => '2006-12-25 05:23:36', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:23:36', 'mytime' => '22:57:17'),
-			array('id' => '5', 'apple_id' => '5', 'color' => 'Green', 'name' => 'Blue Green', 'created' => '2006-12-25 05:24:06', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:29:16', 'mytime' => '22:57:17'),
-			array('id' => '6', 'apple_id' => '4', 'color' => 'My new appleOrange', 'name' => 'My new apple', 'created' => '2006-12-25 05:29:39', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:29:39', 'mytime' => '22:57:17'),
-			array('id' => '7', 'apple_id' => '6', 'color' => 'Some wierd color', 'name' => 'Some odd color', 'created' => '2006-12-25 05:34:21', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:34:21', 'mytime' => '22:57:17')
-		);
-		//$this->assertEquals($Apple->find('all'), $expected);
 	}
 
 /**
@@ -848,18 +809,6 @@ class BehaviorCollectionTest extends CakeTestCase {
 
 		$Apple->Parent->Behaviors->attach('Test', array('after' => 'test2'));
 		$this->assertEquals($Apple->find('all'), $expected);
-
-		$Apple->Parent->Behaviors->attach('Test', array('after' => 'modify'));
-		$expected = array(
-			array('id' => '1', 'apple_id' => '2', 'color' => 'Red 1', 'name' => 'Red Apple 1', 'created' => '2006-11-22 10:38:58', 'date' => '1951-01-04', 'modified' => '2006-12-01 13:31:26', 'mytime' => '22:57:17'),
-			array('id' => '2', 'apple_id' => '1', 'color' => 'Bright Red 1', 'name' => 'Bright Red Apple', 'created' => '2006-11-22 10:43:13', 'date' => '2014-01-01', 'modified' => '2006-11-30 18:38:10', 'mytime' => '22:57:17'),
-			array('id' => '3', 'apple_id' => '2', 'color' => 'blue green', 'name' => 'green blue', 'created' => '2006-12-25 05:13:36', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:23:24', 'mytime' => '22:57:17'),
-			array('id' => '4', 'apple_id' => '2', 'color' => 'Blue Green', 'name' => 'Test Name', 'created' => '2006-12-25 05:23:36', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:23:36', 'mytime' => '22:57:17'),
-			array('id' => '5', 'apple_id' => '5', 'color' => 'Green', 'name' => 'Blue Green', 'created' => '2006-12-25 05:24:06', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:29:16', 'mytime' => '22:57:17'),
-			array('id' => '6', 'apple_id' => '4', 'color' => 'My new appleOrange', 'name' => 'My new apple', 'created' => '2006-12-25 05:29:39', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:29:39', 'mytime' => '22:57:17'),
-			array('id' => '7', 'apple_id' => '6', 'color' => 'Some wierd color', 'name' => 'Some odd color', 'created' => '2006-12-25 05:34:21', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:34:21', 'mytime' => '22:57:17')
-		);
-		//$this->assertEquals($Apple->find('all'), $expected);
 	}
 
 /**
@@ -968,7 +917,6 @@ class BehaviorCollectionTest extends CakeTestCase {
 		$this->assertSame(trim(ob_get_clean()), 'beforeDelete success');
 		$this->assertSame($results, true);
 
-
 		$Apple->Behaviors->attach('Test', array('beforeDelete' => 'off', 'afterDelete' => 'on'));
 		ob_start();
 		$results = $Apple->delete(2, false);
@@ -1190,5 +1138,4 @@ class BehaviorCollectionTest extends CakeTestCase {
 		$this->assertEquals($expected, $result);
 	}
 
-
 }

+ 45 - 38
lib/Cake/Test/Case/Model/CakeSchemaTest.php

@@ -113,6 +113,7 @@ class MyAppSchema extends CakeSchema {
 		}
 		return $this->$var;
 	}
+
 }
 
 /**
@@ -219,6 +220,7 @@ class TestAppSchema extends CakeSchema {
  */
 	public function teardown($version) {
 	}
+
 }
 
 /**
@@ -434,6 +436,7 @@ class SchemaCrossDatabaseFixture extends CakeTestFixture {
  * @package       Cake.Test.Case.Model
  */
 class SchemaPrefixAuthUser extends CakeTestModel {
+
 /**
  * name property
  *
@@ -493,8 +496,8 @@ class CakeSchemaTest extends CakeTestCase {
  */
 	public function tearDown() {
 		parent::tearDown();
-		if (file_exists(TMP . 'tests' . DS .'schema.php')) {
-			unlink(TMP . 'tests' . DS .'schema.php');
+		if (file_exists(TMP . 'tests' . DS . 'schema.php')) {
+			unlink(TMP . 'tests' . DS . 'schema.php');
 		}
 		unset($this->Schema);
 		CakePlugin::unload();
@@ -570,20 +573,20 @@ class CakeSchemaTest extends CakeTestCase {
 	}
 
 /**
-* testSchemaReadWithAppModel method
-*
-* @access public
-* @return void
-*/
+ * testSchemaReadWithAppModel method
+ *
+ * @access public
+ * @return void
+ */
 	public function testSchemaReadWithAppModel() {
 		$connections = ConnectionManager::enumConnectionObjects();
 		ConnectionManager::drop('default');
 		ConnectionManager::create('default', $connections['test']);
 		try {
 			$read = $this->Schema->read(array(
-					'connection' => 'default',
-					'name' => 'TestApp',
-					'models' => array('AppModel')
+				'connection' => 'default',
+				'name' => 'TestApp',
+				'models' => array('AppModel')
 			));
 		} catch(MissingTableException $mte) {
 			ConnectionManager::drop('default');
@@ -632,7 +635,6 @@ class CakeSchemaTest extends CakeTestCase {
 		));
 		unset($read['tables']['missing']);
 		$this->assertTrue(isset($read['tables']['auth_users']), 'auth_users key missing %s');
-
 	}
 
 /**
@@ -699,14 +701,15 @@ class CakeSchemaTest extends CakeTestCase {
 		$config = ConnectionManager::enumConnectionObjects();
 		$this->skipIf(
 			!isset($config['test']) || !isset($config['test2']),
-			'Primary and secondary test databases not configured, skipping cross-database join tests.'
-			. ' To run these tests, you must define $test and $test2 in your database configuration.'
+			'Primary and secondary test databases not configured, ' .
+			'skipping cross-database join tests. ' .
+			'To run these tests, you must define $test and $test2 in your database configuration.'
 		);
 
-		$db2 = ConnectionManager::getDataSource('test2');
+		$db = ConnectionManager::getDataSource('test2');
 		$fixture = new SchemaCrossDatabaseFixture();
-		$fixture->create($db2);
-		$fixture->insert($db2);
+		$fixture->create($db);
+		$fixture->insert($db);
 
 		$read = $this->Schema->read(array(
 			'connection' => 'test',
@@ -726,7 +729,7 @@ class CakeSchemaTest extends CakeTestCase {
 		$this->assertFalse(isset($read['tables']['posts']), 'Posts should not appear');
 		$this->assertTrue(isset($read['tables']['cross_database']));
 
-		$fixture->drop($db2);
+		$fixture->drop($db);
 	}
 
 /**
@@ -755,11 +758,15 @@ class CakeSchemaTest extends CakeTestCase {
  * @return void
  */
 	public function testSchemaWrite() {
-		$write = $this->Schema->write(array('name' => 'MyOtherApp', 'tables' => $this->Schema->tables, 'path' => TMP . 'tests'));
-		$file = file_get_contents(TMP . 'tests' . DS .'schema.php');
+		$write = $this->Schema->write(array(
+			'name' => 'MyOtherApp',
+			'tables' => $this->Schema->tables,
+			'path' => TMP . 'tests'
+		));
+		$file = file_get_contents(TMP . 'tests' . DS . 'schema.php');
 		$this->assertEquals($write, $file);
 
-		require_once( TMP . 'tests' . DS .'schema.php');
+		require_once TMP . 'tests' . DS . 'schema.php';
 		$OtherSchema = new MyOtherAppSchema();
 		$this->assertEquals($this->Schema->tables, $OtherSchema->tables);
 	}
@@ -807,21 +814,21 @@ class CakeSchemaTest extends CakeTestCase {
 		$tables = array(
 			'missing' => array(
 				'categories' => array(
-					'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'),
-					'created' => array('type' => 'datetime', 'null' => false, 'default' => NULL),
-					'modified' => array('type' => 'datetime', 'null' => false, 'default' => NULL),
-					'name' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 100),
+					'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'),
+					'created' => array('type' => 'datetime', 'null' => false, 'default' => null),
+					'modified' => array('type' => 'datetime', 'null' => false, 'default' => null),
+					'name' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 100),
 					'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)),
 					'tableParameters' => array('charset' => 'latin1', 'collate' => 'latin1_swedish_ci', 'engine' => 'MyISAM')
 				)
 			),
 			'ratings' => array(
-				'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'),
-				'foreign_key' => array('type' => 'integer', 'null' => false, 'default' => NULL),
-				'model' => array('type' => 'varchar', 'null' => false, 'default' => NULL),
-				'value' => array('type' => 'float', 'null' => false, 'length' => '5,2', 'default' => NULL),
-				'created' => array('type' => 'datetime', 'null' => false, 'default' => NULL),
-				'modified' => array('type' => 'datetime', 'null' => false, 'default' => NULL),
+				'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'),
+				'foreign_key' => array('type' => 'integer', 'null' => false, 'default' => null),
+				'model' => array('type' => 'varchar', 'null' => false, 'default' => null),
+				'value' => array('type' => 'float', 'null' => false, 'length' => '5,2', 'default' => null),
+				'created' => array('type' => 'datetime', 'null' => false, 'default' => null),
+				'modified' => array('type' => 'datetime', 'null' => false, 'default' => null),
 				'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)),
 				'tableParameters' => array('charset' => 'latin1', 'collate' => 'latin1_swedish_ci', 'engine' => 'MyISAM')
 			)
@@ -830,12 +837,12 @@ class CakeSchemaTest extends CakeTestCase {
 		$expected = array(
 			'ratings' => array(
 				'add' => array(
-					'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'),
-					'foreign_key' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'after' => 'id'),
-					'model' => array('type' => 'varchar', 'null' => false, 'default' => NULL, 'after' => 'foreign_key'),
-					'value' => array('type' => 'float', 'null' => false, 'length' => '5,2', 'default' => NULL, 'after' => 'model'),
-					'created' => array('type' => 'datetime', 'null' => false, 'default' => NULL, 'after' => 'value'),
-					'modified' => array('type' => 'datetime', 'null' => false, 'default' => NULL, 'after' => 'created'),
+					'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'),
+					'foreign_key' => array('type' => 'integer', 'null' => false, 'default' => null, 'after' => 'id'),
+					'model' => array('type' => 'varchar', 'null' => false, 'default' => null, 'after' => 'foreign_key'),
+					'value' => array('type' => 'float', 'null' => false, 'length' => '5,2', 'default' => null, 'after' => 'model'),
+					'created' => array('type' => 'datetime', 'null' => false, 'default' => null, 'after' => 'value'),
+					'modified' => array('type' => 'datetime', 'null' => false, 'default' => null, 'after' => 'created'),
 					'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)),
 					'tableParameters' => array('charset' => 'latin1', 'collate' => 'latin1_swedish_ci', 'engine' => 'MyISAM')
 				)
@@ -852,13 +859,13 @@ class CakeSchemaTest extends CakeTestCase {
 	public function testCompareEmptyStringAndNull() {
 		$One = new CakeSchema(array(
 			'posts' => array(
-				'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'),
+				'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'),
 				'name' => array('type' => 'string', 'null' => false, 'default' => '')
 			)
 		));
 		$Two = new CakeSchema(array(
 			'posts' => array(
-				'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'),
+				'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'),
 				'name' => array('type' => 'string', 'null' => false, 'default' => null)
 			)
 		));

+ 2 - 2
lib/Cake/Test/Case/Model/ConnectionManagerTest.php

@@ -208,8 +208,8 @@ class ConnectionManagerTest extends CakeTestCase {
  */
 	public function testLoadDataSource() {
 		$connections = array(
-			array('classname' => 'Mysql', 'filename' =>  'Mysql', 'package' => 'Database'),
-			array('classname' => 'Postgres', 'filename' =>  'Postgres', 'package' => 'Database'),
+			array('classname' => 'Mysql', 'filename' => 'Mysql', 'package' => 'Database'),
+			array('classname' => 'Postgres', 'filename' => 'Postgres', 'package' => 'Database'),
 			array('classname' => 'Sqlite', 'filename' => 'Sqlite', 'package' => 'Database'),
 		);
 

+ 4 - 1
lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php

@@ -23,8 +23,11 @@ App::uses('DatabaseSession', 'Model/Datasource/Session');
 class_exists('CakeSession');
 
 class SessionTestModel extends Model {
+
 	public $name = 'SessionTestModel';
+
 	public $useTable = 'sessions';
+
 }
 
 /**
@@ -182,4 +185,4 @@ class DatabaseSessionTest extends CakeTestCase {
 		$storage->gc();
 		$this->assertFalse($storage->read('foo'));
 	}
-}
+}

+ 6 - 4
lib/Cake/Test/Case/Model/ModelCrossSchemaHabtmTest.php

@@ -66,8 +66,9 @@ class ModelCrossSchemaHabtmTest extends BaseModelTest {
 		$this->skipIf($this->db instanceof Sqlite, 'This test is not compatible with Sqlite.');
 		$this->skipIf(
 			!isset($config['test']) || !isset($config['test2']),
-			 'Primary and secondary test databases not configured, skipping cross-database join tests.'
-			. ' To run these tests, you must define $test and $test2 in your database configuration.'
+			'Primary and secondary test databases not configured, ' .
+			'skipping cross-database join tests.' .
+			' To run these tests, you must define $test and $test2 in your database configuration.'
 		);
 	}
 
@@ -176,8 +177,9 @@ class ModelCrossSchemaHabtmTest extends BaseModelTest {
 		$config = ConnectionManager::enumConnectionObjects();
 		$this->skipIf(
 			!isset($config['test']) || !isset($config['test2']) || !isset($config['test_database_three']),
-			 'Primary, secondary, and tertiary test databases not configured, skipping test.'
-			. ' To run these tests, you must define $test, $test2, and $test_database_three in your database configuration.'
+			'Primary, secondary, and tertiary test databases not configured,' .
+			' skipping test. To run these tests, you must define ' .
+			'$test, $test2, and $test_database_three in your database configuration.'
 		);
 
 		$this->loadFixtures('Player', 'Guild', 'GuildsPlayer', 'Armor', 'ArmorsPlayer');

+ 5 - 6
lib/Cake/Test/Case/Model/ModelDeleteTest.php

@@ -260,7 +260,6 @@ class ModelDeleteTest extends BaseModelTest {
 		$this->assertEquals($expected, $result);
 	}
 
-
 /**
  * test that delete() updates the correct records counterCache() records.
  *
@@ -688,7 +687,6 @@ class ModelDeleteTest extends BaseModelTest {
  * @return void
  */
 	public function testHabtmDeleteLinksWhenNoPrimaryKeyInJoinTable() {
-
 		$this->loadFixtures('Apple', 'Device', 'ThePaperMonkies');
 		$ThePaper = new ThePaper();
 		$ThePaper->id = 1;
@@ -792,25 +790,26 @@ class ModelDeleteTest extends BaseModelTest {
 		$this->assertEquals(count($before[0]['Tag']), 2, 'Tag count for Article.id = 1 is incorrect, should be 2 %s');
 
 		// From now on, Tag #1 is only associated with Post #1
-		$submitted_data = array(
+		$submittedData = array(
 			"Tag" => array("id" => 1, 'tag' => 'tag1'),
 			"Article" => array(
 				"Article" => array(1)
 			)
 		);
-		$Tag->save($submitted_data);
+		$Tag->save($submittedData);
 
 		// One more submission (The other way around) to make sure the reverse save looks good.
-		$submitted_data = array(
+		$submittedData = array(
 			"Article" => array("id" => 2, 'title' => 'second article'),
 			"Tag" => array(
 				"Tag" => array(2, 3)
 			)
 		);
+
 		// ERROR:
 		// Postgresql: DELETE FROM "articles_tags" WHERE tag_id IN ('1', '3')
 		// MySQL: DELETE `ArticlesTag` FROM `articles_tags` AS `ArticlesTag` WHERE `ArticlesTag`.`article_id` = 2 AND `ArticlesTag`.`tag_id` IN (1, 3)
-		$Article->save($submitted_data);
+		$Article->save($submittedData);
 
 		// Want to make sure Article #1 has Tag #1 and Tag #2 still.
 		$after = $Article->find("all", array(

+ 14 - 17
lib/Cake/Test/Case/Model/ModelIntegrationTest.php

@@ -27,18 +27,19 @@ App::uses('DboSource', 'Model/Datasource');
 class DboMock extends DboSource {
 
 /**
-* Returns the $field without modifications
-*/
+ * Returns the $field without modifications
+ */
 	public function name($field) {
 		return $field;
 	}
 
 /**
-* Returns true to fake a database connection
-*/
+ * Returns true to fake a database connection
+ */
 	public function connect() {
 		return true;
 	}
+
 }
 
 /**
@@ -149,8 +150,8 @@ class ModelIntegrationTest extends BaseModelTest {
  */
 	public function testPkInHabtmLinkModelArticleB() {
 		$this->loadFixtures('Article', 'Tag', 'ArticlesTag');
-		$TestModel2 = new ArticleB();
-		$this->assertEquals($TestModel2->ArticlesTag->primaryKey, 'article_id');
+		$TestModel = new ArticleB();
+		$this->assertEquals($TestModel->ArticlesTag->primaryKey, 'article_id');
 	}
 
 /**
@@ -176,7 +177,7 @@ class ModelIntegrationTest extends BaseModelTest {
 /**
  * testPkInHabtmLinkModel method
  *
-	 * @return void
+ * @return void
  */
 	public function testPkInHabtmLinkModel() {
 		//Test Nonconformant Models
@@ -186,18 +187,17 @@ class ModelIntegrationTest extends BaseModelTest {
 
 		//test conformant models with no PK in the join table
 		$this->loadFixtures('Article', 'Tag');
-		$TestModel2 = new Article();
-		$this->assertEquals($TestModel2->ArticlesTag->primaryKey, 'article_id');
+		$TestModel = new Article();
+		$this->assertEquals($TestModel->ArticlesTag->primaryKey, 'article_id');
 
 		//test conformant models with PK in join table
-		$TestModel3 = new Portfolio();
-		$this->assertEquals($TestModel3->ItemsPortfolio->primaryKey, 'id');
+		$TestModel = new Portfolio();
+		$this->assertEquals($TestModel->ItemsPortfolio->primaryKey, 'id');
 
 		//test conformant models with PK in join table - join table contains extra field
 		$this->loadFixtures('JoinA', 'JoinB', 'JoinAB');
-		$TestModel4 = new JoinA();
-		$this->assertEquals($TestModel4->JoinAsJoinB->primaryKey, 'id');
-
+		$TestModel = new JoinA();
+		$this->assertEquals($TestModel->JoinAsJoinB->primaryKey, 'id');
 	}
 
 /**
@@ -645,7 +645,6 @@ class ModelIntegrationTest extends BaseModelTest {
 		$expected = 3; // 3 domains belonging to cakephp
 		$this->assertEquals($expected, count($results['Domain']));
 
-
 		$Site->id = 2;
 		$results = $Site->read();
 		$expected = 2; // 2 domains belonging to markstory
@@ -2345,7 +2344,6 @@ class ModelIntegrationTest extends BaseModelTest {
  * @return void
  */
 	public function testMultischemaFixture() {
-
 		$config = ConnectionManager::enumConnectionObjects();
 		$this->skipIf($this->db instanceof Sqlite, 'This test is not compatible with Sqlite.');
 		$this->skipIf(!isset($config['test']) || !isset($config['test2']),
@@ -2375,7 +2373,6 @@ class ModelIntegrationTest extends BaseModelTest {
  * @return void
  */
 	public function testMultischemaFixtureWithThreeDatabases() {
-
 		$config = ConnectionManager::enumConnectionObjects();
 		$this->skipIf($this->db instanceof Sqlite, 'This test is not compatible with Sqlite.');
 		$this->skipIf(

+ 13 - 14
lib/Cake/Test/Case/Model/ModelReadTest.php

@@ -68,7 +68,6 @@ class ModelReadTest extends BaseModelTest {
 			)
 		);
 
-
 		$Something->JoinThing->create($joinThingData);
 		$Something->JoinThing->save();
 
@@ -347,7 +346,6 @@ class ModelReadTest extends BaseModelTest {
 
 		$result = $this->db->getQueryCache($query, $params);
 		$this->assertFalse($result === false);
-
 	}
 
 /**
@@ -6199,17 +6197,20 @@ class ModelReadTest extends BaseModelTest {
 
 		$expected = array(
 			'conditions' => array(
-				'user' => 'larry'),
-			'fields' => NULL,
+				'user' => 'larry'
+			),
+			'fields' => null,
 			'joins' => array(),
-			'limit' => NULL,
-			'offset' => NULL,
+			'limit' => null,
+			'offset' => null,
 			'order' => array(
-				0 => NULL),
+				0 => null
+			),
 			'page' => 1,
-			'group' => NULL,
+			'group' => null,
 			'callbacks' => true,
-			'returnQuery' => true);
+			'returnQuery' => true
+		);
 		$result = $TestModel->buildQuery('all', array('returnQuery' => true, 'conditions' => array('user' => 'larry')));
 		$this->assertEquals($expected, $result);
 	}
@@ -7736,7 +7737,6 @@ class ModelReadTest extends BaseModelTest {
 
 		$this->assertEquals($result, $expectation);
 
-
 		$Author = ClassRegistry::init('Author');
 		$Author->virtualFields = array(
 			'full_name' => 'CONCAT(Author.user, " ", Author.id)'
@@ -7804,7 +7804,6 @@ class ModelReadTest extends BaseModelTest {
 		$this->assertEquals($Post->getVirtualField('Post.other_field'), $Post->virtualFields['other_field']);
 	}
 
-
 /**
  * test that checks for error when NOT condition passed in key and a 1 element array value
  *
@@ -7823,9 +7822,8 @@ class ModelReadTest extends BaseModelTest {
 				)
 			)
 		);
-
 		$this->assertTrue(is_array($result) && !empty($result));
-    }
+	}
 
 /**
  * test custom find method
@@ -7845,5 +7843,6 @@ class ModelReadTest extends BaseModelTest {
 
 		$result = $Article->find('unPublished');
 		$this->assertEquals(1, count($result));
-    }
+	}
+
 }

+ 1 - 1
lib/Cake/Test/Case/Model/ModelValidationTest.php

@@ -51,7 +51,7 @@ class ModelValidationTest extends BaseModelTest {
 				'required' => true
 			),
 			'or' => true,
-			'ignore_on_same' => 'id'
+			'ignoreOnSame' => 'id'
 		);
 		$this->assertEquals($TestModel->validatorParams, $expected);
 

+ 10 - 17
lib/Cake/Test/Case/Model/ModelWriteTest.php

@@ -109,7 +109,6 @@ class ModelWriteTest extends BaseModelTest {
 
 		$this->assertEquals($testResult['Article']['title'], $data['Article']['title']);
 		$this->assertEquals($testResult['Article']['created'], '2008-01-01 00:00:00');
-
 	}
 
 /**
@@ -403,7 +402,7 @@ class ModelWriteTest extends BaseModelTest {
 			$column = '';
 		}
 		$column .= $this->db->buildColumn(array('name' => 'child_count', 'type' => 'integer'));
-		$this->db->query('ALTER TABLE '. $this->db->fullTableName('category_threads') . ' ADD ' . $column);
+		$this->db->query('ALTER TABLE ' . $this->db->fullTableName('category_threads') . ' ADD ' . $column);
 		$this->db->flushMethodCache();
 		$Category = new CategoryThread();
 		$result = $Category->updateAll(array('CategoryThread.name' => "'updated'"), array('CategoryThread.parent_id' => 5));
@@ -617,7 +616,6 @@ class ModelWriteTest extends BaseModelTest {
 		$result = $TestModel->saveField('title', '', true);
 		$this->assertFalse($result);
 
-
 		$TestModel->recursive = -1;
 		$TestModel->id = 1;
 		$result = $TestModel->saveField('user_id', 9999);
@@ -630,7 +628,6 @@ class ModelWriteTest extends BaseModelTest {
 		));
 		$this->assertEquals($expected, $result);
 
-
 		$this->loadFixtures('Node', 'Dependency');
 		$Node = new Node();
 		$Node->set('id', 1);
@@ -1512,12 +1509,16 @@ class ModelWriteTest extends BaseModelTest {
 			),
 			'Tag' => array(
 				'Tag' => array(1, 2, 3)
-		));
-		$result =  $TestModel->create()
+			)
+		);
+		$result = $TestModel->create()
 				&& $TestModel->save($data, true, array('user_id', 'title', 'published'));
 		$this->assertFalse(empty($result));
 
-		$TestModel->unbindModel(array('belongsTo' => array('User'), 'hasMany' => array('Comment')));
+		$TestModel->unbindModel(array(
+			'belongsTo' => array('User'),
+			'hasMany' => array('Comment')
+		));
 		$result = $TestModel->read();
 		$expected = array(
 			'Article' => array(
@@ -1550,7 +1551,6 @@ class ModelWriteTest extends BaseModelTest {
 		)));
 		$this->assertEquals($expected, $result);
 
-
 		$this->loadFixtures('JoinA', 'JoinC', 'JoinAC', 'JoinB', 'JoinAB');
 		$TestModel = new JoinA();
 		$TestModel->hasBelongsToMany = array('JoinC' => array('unique' => true));
@@ -2754,7 +2754,6 @@ class ModelWriteTest extends BaseModelTest {
 		unset($result[6]['Comment']['created'], $result[6]['Comment']['updated']);
 		$this->assertEquals($result[6]['Comment'], $expected);
 
-
 		$expected = array(
 			'id' => '2',
 			'comment_id' => '7',
@@ -2878,7 +2877,6 @@ class ModelWriteTest extends BaseModelTest {
 		)));
 		$this->assertEquals($expected, $result);
 
-
 		$model->Attachment->bindModel(array('belongsTo' => array('Comment')), false);
 		$data = array(
 			'Comment' => array(
@@ -4545,7 +4543,6 @@ class ModelWriteTest extends BaseModelTest {
 		$result = Set::extract('/Comment/article_id', $result);
 		$this->assertEquals($result[0], 4);
 
-
 		$model->deleteAll(true);
 		$data = array(
 			'Article' => array(
@@ -4801,7 +4798,6 @@ class ModelWriteTest extends BaseModelTest {
 		unset($result[6]['Comment']['updated'], $result[6]['Comment']['created']);
 		$this->assertEquals($result[6]['Comment'], $expected);
 
-
 		$expected = array(
 			'id' => '2',
 			'comment_id' => '7',
@@ -4985,7 +4981,6 @@ class ModelWriteTest extends BaseModelTest {
 		)));
 		$this->assertEquals($expected, $result);
 
-
 		$model->Attachment->bindModel(array('belongsTo' => array('Comment')), false);
 		$data = array(
 			'Comment' => array(
@@ -5155,7 +5150,6 @@ class ModelWriteTest extends BaseModelTest {
 		), array('validate' => true, 'atomic' => false));
 
 		$this->assertSame($result, array(true, false));
-
 	}
 
 /**
@@ -5850,7 +5844,6 @@ class ModelWriteTest extends BaseModelTest {
 		$result = Set::extract('/Comment/article_id', $result);
 		$this->assertEquals($result[0], 4);
 
-
 		$model->deleteAll(true);
 		$data = array(
 			'Article' => array(
@@ -6335,7 +6328,7 @@ class ModelWriteTest extends BaseModelTest {
 				'id' => '4',
 				'author_id' => '5',
 				'title' => 'Post without body',
-				'body' => NULL,
+				'body' => null,
 				'published' => 'N',
 				'created' => $ts,
 				'updated' => $ts,
@@ -6343,7 +6336,7 @@ class ModelWriteTest extends BaseModelTest {
 			'Author' => array (
 				'id' => '5',
 				'user' => 'bob',
-				'password' => NULL,
+				'password' => null,
 				'created' => $ts,
 				'updated' => $ts,
 				'test' => 'working',

File diff suppressed because it is too large
+ 242 - 80
lib/Cake/Test/Case/Model/models.php