Skip to content
This repository
Browse code

simplyfy test and correct some test param orders

  • Loading branch information...
commit 47e8e0c57a3e2a79c008a1be3d2795bf1d726a64 1 parent 6cf147e
Mark authored August 16, 2013
12  lib/Cake/Test/Case/Model/ModelValidationTest.php
@@ -588,7 +588,7 @@ public function testValidatesWithAssociations() {
588 588
 		$this->assertFalse($result, 'Save occurred even when with models failed. %s');
589 589
 		$this->assertEquals($expectedError, $JoinThing->validationErrors);
590 590
 		$count = $Something->find('count', array('conditions' => array('Something.id' => $data['Something']['id'])));
591  
-		$this->assertSame($count, 0);
  591
+		$this->assertSame(0, $count);
592 592
 
593 593
 		$data = array(
594 594
 			'Something' => array(
@@ -651,7 +651,7 @@ public function testValidatesWithModelsAndSaveAll() {
651 651
 		$this->assertEquals($expectedError, $JoinThing->validationErrors);
652 652
 
653 653
 		$count = $Something->find('count', array('conditions' => array('Something.id' => $data['Something']['id'])));
654  
-		$this->assertSame($count, 0);
  654
+		$this->assertSame(0, $count);
655 655
 
656 656
 		$joinRecords = $JoinThing->find('count', array(
657 657
 			'conditions' => array('JoinThing.something_id' => $data['Something']['id'])
@@ -692,11 +692,11 @@ public function testValidatesWithModelsAndSaveAllWithoutId() {
692 692
 		$Author->create();
693 693
 		$result = $Author->saveAll($data, array('validate' => 'first'));
694 694
 		$this->assertTrue($result);
695  
-		$this->assertFalse($Author->id === null);
  695
+		$this->assertNotNull($Author->id);
696 696
 
697 697
 		$id = $Author->id;
698 698
 		$count = $Author->find('count', array('conditions' => array('Author.id' => $id)));
699  
-		$this->assertSame($count, 1);
  699
+		$this->assertSame(1, $count);
700 700
 
701 701
 		$count = $Post->find('count', array(
702 702
 			'conditions' => array('Post.author_id' => $id)
@@ -2315,7 +2315,7 @@ public function testValidateAssociatedAtomicFalseDeepTrueWithErrors() {
2315 2315
 				),
2316 2316
 			),
2317 2317
 		);
2318  
-		$this->assertEquals($result, $expected);
  2318
+		$this->assertEquals($expected, $result);
2319 2319
 	}
2320 2320
 
2321 2321
 /**
@@ -2376,7 +2376,7 @@ public function testValidateManyAtomicFalseDeepTrueWithErrors() {
2376 2376
 				),
2377 2377
 			),
2378 2378
 		);
2379  
-		$this->assertEquals($result, $expected);
  2379
+		$this->assertEquals($expected, $result);
2380 2380
 	}
2381 2381
 
2382 2382
 }

0 notes on commit 47e8e0c

Please sign in to comment.
Something went wrong with that request. Please try again.