Skip to content
This repository
Browse code

Test all empty array with assertSame() because assertEquals() does no…

…t check the type.
  • Loading branch information...
commit a7d9422c099694031503c2772c5e2cf3c4d39385 1 parent 870d77c
Ber Clausen authored October 26, 2012
2  lib/Cake/Test/Case/BasicsTest.php
@@ -67,7 +67,7 @@ public function testArrayDiffKey() {
67 67
 		$one = array('minYear' => null, 'maxYear' => null, 'separator' => '-', 'interval' => 1, 'monthNames' => true);
68 68
 		$two = array('minYear' => null, 'maxYear' => null, 'separator' => '-', 'interval' => 1, 'monthNames' => true);
69 69
 		$result = array_diff_key($one, $two);
70  
-		$this->assertEquals(array(), $result);
  70
+		$this->assertSame(array(), $result);
71 71
 	}
72 72
 
73 73
 /**
4  lib/Cake/Test/Case/Console/Command/Task/ControllerTaskTest.php
@@ -181,7 +181,7 @@ public function testGetNameInvalidIndex() {
181 181
 	public function testDoHelpersNo() {
182 182
 		$this->Task->expects($this->any())->method('in')->will($this->returnValue('n'));
183 183
 		$result = $this->Task->doHelpers();
184  
-		$this->assertEquals(array(), $result);
  184
+		$this->assertSame(array(), $result);
185 185
 	}
186 186
 
187 187
 /**
@@ -218,7 +218,7 @@ public function testDoHelpersTrailingCommas() {
218 218
 	public function testDoComponentsNo() {
219 219
 		$this->Task->expects($this->any())->method('in')->will($this->returnValue('n'));
220 220
 		$result = $this->Task->doComponents();
221  
-		$this->assertEquals(array(), $result);
  221
+		$this->assertSame(array(), $result);
222 222
 	}
223 223
 
224 224
 /**
6  lib/Cake/Test/Case/Core/AppTest.php
@@ -347,7 +347,7 @@ public function testListObjects() {
347 347
 		$this->assertEquals($expected, $result);
348 348
 
349 349
 		$result = App::objects('NonExistingType');
350  
-		$this->assertEquals(array(), $result);
  350
+		$this->assertSame(array(), $result);
351 351
 
352 352
 		App::build(array(
353 353
 			'plugins' => array(
@@ -414,9 +414,9 @@ public function testListObjectsInPlugin() {
414 414
 		$this->assertTrue(in_array('OtherComponent', $result));
415 415
 
416 416
 		$result = App::objects('TestPluginTwo.behavior');
417  
-		$this->assertEquals(array(), $result);
  417
+		$this->assertSame(array(), $result);
418 418
 		$result = App::objects('TestPluginTwo.Model/Behavior');
419  
-		$this->assertEquals(array(), $result);
  419
+		$this->assertSame(array(), $result);
420 420
 
421 421
 		$result = App::objects('model', null, false);
422 422
 		$this->assertTrue(in_array('Comment', $result));
2  lib/Cake/Test/Case/Log/CakeLogTest.php
@@ -175,7 +175,7 @@ public function testDrop() {
175 175
 
176 176
 		CakeLog::drop('file');
177 177
 		$result = CakeLog::configured();
178  
-		$this->assertEquals(array(), $result);
  178
+		$this->assertSame(array(), $result);
179 179
 	}
180 180
 
181 181
 /**
6  lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php
@@ -422,7 +422,7 @@ public function testMissingTranslation() {
422 422
 		$TestModel = new TranslatedItem();
423 423
 		$TestModel->locale = 'rus';
424 424
 		$result = $TestModel->read(null, 1);
425  
-		$this->assertEquals(array(), $result);
  425
+		$this->assertSame(array(), $result);
426 426
 
427 427
 		$TestModel->locale = array('rus');
428 428
 		$result = $TestModel->read(null, 1);
@@ -460,10 +460,10 @@ public function testTranslatedFindList() {
460 460
 			Configure::write('debug', 0);
461 461
 
462 462
 			$result = $TestModel->find('list', array('recursive' => 1, 'callbacks' => false));
463  
-			$this->assertEquals(array(), $result);
  463
+			$this->assertSame(array(), $result);
464 464
 
465 465
 			$result = $TestModel->find('list', array('recursive' => 1, 'callbacks' => 'after'));
466  
-			$this->assertEquals(array(), $result);
  466
+			$this->assertSame(array(), $result);
467 467
 			Configure::write('debug', $debug);
468 468
 		}
469 469
 
2  lib/Cake/Test/Case/Model/Datasource/Database/SqlserverTest.php
@@ -574,7 +574,7 @@ public function testBuildIndex() {
574 574
 
575 575
 		$indexes = array('client_id' => array('column' => 'client_id'));
576 576
 		$result = $this->db->buildIndex($indexes, 'items');
577  
-		$this->assertEquals(array(), $result);
  577
+		$this->assertSame(array(), $result);
578 578
 
579 579
 		$indexes = array('client_id' => array('column' => array('client_id', 'period_id'), 'unique' => 1));
580 580
 		$result = $this->db->buildIndex($indexes, 'items');
16  lib/Cake/Test/Case/Model/ModelDeleteTest.php
@@ -107,12 +107,12 @@ public function testDeleteHabtmReferenceWithConditions() {
107 107
 		$result = $Portfolio->find('first', array(
108 108
 			'conditions' => array('Portfolio.id' => 1)
109 109
 		));
110  
-		$this->assertEquals(array(), $result);
  110
+		$this->assertSame(array(), $result);
111 111
 
112 112
 		$result = $Portfolio->ItemsPortfolio->find('all', array(
113 113
 			'conditions' => array('ItemsPortfolio.portfolio_id' => 1)
114 114
 		));
115  
-		$this->assertEquals(array(), $result);
  115
+		$this->assertSame(array(), $result);
116 116
 	}
117 117
 
118 118
 /**
@@ -195,7 +195,7 @@ public function testDelete() {
195 195
 		$this->assertTrue($result);
196 196
 
197 197
 		$result = $TestModel->read(null, 2);
198  
-		$this->assertEquals(array(), $result);
  198
+		$this->assertSame(array(), $result);
199 199
 
200 200
 		$TestModel->recursive = -1;
201 201
 		$result = $TestModel->find('all', array(
@@ -216,7 +216,7 @@ public function testDelete() {
216 216
 		$this->assertTrue($result);
217 217
 
218 218
 		$result = $TestModel->read(null, 3);
219  
-		$this->assertEquals(array(), $result);
  219
+		$this->assertSame(array(), $result);
220 220
 
221 221
 		$TestModel->recursive = -1;
222 222
 		$result = $TestModel->find('all', array(
@@ -448,16 +448,16 @@ public function testRecursiveDel() {
448 448
 
449 449
 		$TestModel->recursive = 2;
450 450
 		$result = $TestModel->read(null, 2);
451  
-		$this->assertEquals(array(), $result);
  451
+		$this->assertSame(array(), $result);
452 452
 
453 453
 		$result = $TestModel->Comment->read(null, 5);
454  
-		$this->assertEquals(array(), $result);
  454
+		$this->assertSame(array(), $result);
455 455
 
456 456
 		$result = $TestModel->Comment->read(null, 6);
457  
-		$this->assertEquals(array(), $result);
  457
+		$this->assertSame(array(), $result);
458 458
 
459 459
 		$result = $TestModel->Comment->Attachment->read(null, 1);
460  
-		$this->assertEquals(array(), $result);
  460
+		$this->assertSame(array(), $result);
461 461
 
462 462
 		$result = $TestModel->find('count');
463 463
 		$this->assertEquals(2, $result);
2  lib/Cake/Test/Case/Model/ModelReadTest.php
@@ -4290,7 +4290,7 @@ public function testBindUnbind() {
4290 4290
 
4291 4291
 		$TestModel->resetAssociations();
4292 4292
 		$result = $TestModel->hasMany;
4293  
-		$this->assertEquals(array(), $result);
  4293
+		$this->assertSame(array(), $result);
4294 4294
 
4295 4295
 		$result = $TestModel->bindModel(array('hasMany' => array('Comment')), false);
4296 4296
 		$this->assertTrue($result);
4  lib/Cake/Test/Case/Model/ModelWriteTest.php
@@ -4536,7 +4536,7 @@ public function testSaveAllValidateFirst() {
4536 4536
 		$this->assertFalse($result);
4537 4537
 
4538 4538
 		$result = $model->find('all');
4539  
-		$this->assertEquals(array(), $result);
  4539
+		$this->assertSame(array(), $result);
4540 4540
 		$expected = array('Comment' => array(
4541 4541
 			1 => array('comment' => array('This field cannot be left blank'))
4542 4542
 		));
@@ -5940,7 +5940,7 @@ public function testSaveAssociatedValidateFirst() {
5940 5940
 		$this->assertFalse($result);
5941 5941
 
5942 5942
 		$result = $model->find('all');
5943  
-		$this->assertEquals(array(), $result);
  5943
+		$this->assertSame(array(), $result);
5944 5944
 		$expected = array('Comment' => array(
5945 5945
 			1 => array('comment' => array('This field cannot be left blank'))
5946 5946
 		));
6  lib/Cake/Test/Case/Routing/RouterTest.php
@@ -111,7 +111,7 @@ public function testMapResources() {
111 111
 
112 112
 		$_SERVER['REQUEST_METHOD'] = 'GET';
113 113
 		$result = Router::parse('/posts/add');
114  
-		$this->assertEquals(array(), $result);
  114
+		$this->assertSame(array(), $result);
115 115
 
116 116
 		Router::reload();
117 117
 		$resources = Router::mapResources('Posts', array('id' => '[a-z0-9_]+'));
@@ -1907,7 +1907,7 @@ public function testParsingWithPatternOnAction() {
1907 1907
 		$this->assertEquals($expected, $result);
1908 1908
 
1909 1909
 		$result = Router::parse('/blog/foobar');
1910  
-		$this->assertEquals(array(), $result);
  1910
+		$this->assertSame(array(), $result);
1911 1911
 
1912 1912
 		$result = Router::url(array('controller' => 'blog_posts', 'action' => 'foo'));
1913 1913
 		$this->assertEquals('/blog_posts/foo', $result);
@@ -2117,7 +2117,7 @@ public function testRegexRouteMatching() {
2117 2117
 		$this->assertEquals($expected, $result);
2118 2118
 
2119 2119
 		$result = Router::parse('/badness/test/test_action');
2120  
-		$this->assertEquals(array(), $result);
  2120
+		$this->assertSame(array(), $result);
2121 2121
 
2122 2122
 		Router::reload();
2123 2123
 		Router::connect('/:locale/:controller/:action/*', array(), array('locale' => 'dan|eng'));
2  lib/Cake/Test/Case/Utility/SetTest.php
@@ -1967,7 +1967,7 @@ public function testCombine() {
1967 1967
 		$this->assertEquals($expected, $result);
1968 1968
 
1969 1969
 		$result = Set::combine($a, 'fail', 'fail');
1970  
-		$this->assertEquals(array(), $result);
  1970
+		$this->assertSame(array(), $result);
1971 1971
 	}
1972 1972
 
1973 1973
 /**
2  lib/Cake/Test/Case/View/Helper/JsHelperTest.php
@@ -904,7 +904,7 @@ public function testObject() {
904 904
 	public function testOptionMapping() {
905 905
 		$JsEngine = new OptionEngineHelper($this->View);
906 906
 		$result = $JsEngine->testMap();
907  
-		$this->assertEquals(array(), $result);
  907
+		$this->assertSame(array(), $result);
908 908
 
909 909
 		$result = $JsEngine->testMap(array('foo' => 'bar', 'baz' => 'sho'));
910 910
 		$this->assertEquals(array('foo' => 'bar', 'baz' => 'sho'), $result);

0 notes on commit a7d9422

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