Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…t check the type.
  • Loading branch information...
commit a7d9422c099694031503c2772c5e2cf3c4d39385 1 parent 870d77c
Ber Clausen bar authored
2  lib/Cake/Test/Case/BasicsTest.php
View
@@ -67,7 +67,7 @@ public function testArrayDiffKey() {
$one = array('minYear' => null, 'maxYear' => null, 'separator' => '-', 'interval' => 1, 'monthNames' => true);
$two = array('minYear' => null, 'maxYear' => null, 'separator' => '-', 'interval' => 1, 'monthNames' => true);
$result = array_diff_key($one, $two);
- $this->assertEquals(array(), $result);
+ $this->assertSame(array(), $result);
}
/**
4 lib/Cake/Test/Case/Console/Command/Task/ControllerTaskTest.php
View
@@ -181,7 +181,7 @@ public function testGetNameInvalidIndex() {
public function testDoHelpersNo() {
$this->Task->expects($this->any())->method('in')->will($this->returnValue('n'));
$result = $this->Task->doHelpers();
- $this->assertEquals(array(), $result);
+ $this->assertSame(array(), $result);
}
/**
@@ -218,7 +218,7 @@ public function testDoHelpersTrailingCommas() {
public function testDoComponentsNo() {
$this->Task->expects($this->any())->method('in')->will($this->returnValue('n'));
$result = $this->Task->doComponents();
- $this->assertEquals(array(), $result);
+ $this->assertSame(array(), $result);
}
/**
6 lib/Cake/Test/Case/Core/AppTest.php
View
@@ -347,7 +347,7 @@ public function testListObjects() {
$this->assertEquals($expected, $result);
$result = App::objects('NonExistingType');
- $this->assertEquals(array(), $result);
+ $this->assertSame(array(), $result);
App::build(array(
'plugins' => array(
@@ -414,9 +414,9 @@ public function testListObjectsInPlugin() {
$this->assertTrue(in_array('OtherComponent', $result));
$result = App::objects('TestPluginTwo.behavior');
- $this->assertEquals(array(), $result);
+ $this->assertSame(array(), $result);
$result = App::objects('TestPluginTwo.Model/Behavior');
- $this->assertEquals(array(), $result);
+ $this->assertSame(array(), $result);
$result = App::objects('model', null, false);
$this->assertTrue(in_array('Comment', $result));
2  lib/Cake/Test/Case/Log/CakeLogTest.php
View
@@ -175,7 +175,7 @@ public function testDrop() {
CakeLog::drop('file');
$result = CakeLog::configured();
- $this->assertEquals(array(), $result);
+ $this->assertSame(array(), $result);
}
/**
6 lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php
View
@@ -422,7 +422,7 @@ public function testMissingTranslation() {
$TestModel = new TranslatedItem();
$TestModel->locale = 'rus';
$result = $TestModel->read(null, 1);
- $this->assertEquals(array(), $result);
+ $this->assertSame(array(), $result);
$TestModel->locale = array('rus');
$result = $TestModel->read(null, 1);
@@ -460,10 +460,10 @@ public function testTranslatedFindList() {
Configure::write('debug', 0);
$result = $TestModel->find('list', array('recursive' => 1, 'callbacks' => false));
- $this->assertEquals(array(), $result);
+ $this->assertSame(array(), $result);
$result = $TestModel->find('list', array('recursive' => 1, 'callbacks' => 'after'));
- $this->assertEquals(array(), $result);
+ $this->assertSame(array(), $result);
Configure::write('debug', $debug);
}
2  lib/Cake/Test/Case/Model/Datasource/Database/SqlserverTest.php
View
@@ -574,7 +574,7 @@ public function testBuildIndex() {
$indexes = array('client_id' => array('column' => 'client_id'));
$result = $this->db->buildIndex($indexes, 'items');
- $this->assertEquals(array(), $result);
+ $this->assertSame(array(), $result);
$indexes = array('client_id' => array('column' => array('client_id', 'period_id'), 'unique' => 1));
$result = $this->db->buildIndex($indexes, 'items');
16 lib/Cake/Test/Case/Model/ModelDeleteTest.php
View
@@ -107,12 +107,12 @@ public function testDeleteHabtmReferenceWithConditions() {
$result = $Portfolio->find('first', array(
'conditions' => array('Portfolio.id' => 1)
));
- $this->assertEquals(array(), $result);
+ $this->assertSame(array(), $result);
$result = $Portfolio->ItemsPortfolio->find('all', array(
'conditions' => array('ItemsPortfolio.portfolio_id' => 1)
));
- $this->assertEquals(array(), $result);
+ $this->assertSame(array(), $result);
}
/**
@@ -195,7 +195,7 @@ public function testDelete() {
$this->assertTrue($result);
$result = $TestModel->read(null, 2);
- $this->assertEquals(array(), $result);
+ $this->assertSame(array(), $result);
$TestModel->recursive = -1;
$result = $TestModel->find('all', array(
@@ -216,7 +216,7 @@ public function testDelete() {
$this->assertTrue($result);
$result = $TestModel->read(null, 3);
- $this->assertEquals(array(), $result);
+ $this->assertSame(array(), $result);
$TestModel->recursive = -1;
$result = $TestModel->find('all', array(
@@ -448,16 +448,16 @@ public function testRecursiveDel() {
$TestModel->recursive = 2;
$result = $TestModel->read(null, 2);
- $this->assertEquals(array(), $result);
+ $this->assertSame(array(), $result);
$result = $TestModel->Comment->read(null, 5);
- $this->assertEquals(array(), $result);
+ $this->assertSame(array(), $result);
$result = $TestModel->Comment->read(null, 6);
- $this->assertEquals(array(), $result);
+ $this->assertSame(array(), $result);
$result = $TestModel->Comment->Attachment->read(null, 1);
- $this->assertEquals(array(), $result);
+ $this->assertSame(array(), $result);
$result = $TestModel->find('count');
$this->assertEquals(2, $result);
2  lib/Cake/Test/Case/Model/ModelReadTest.php
View
@@ -4290,7 +4290,7 @@ public function testBindUnbind() {
$TestModel->resetAssociations();
$result = $TestModel->hasMany;
- $this->assertEquals(array(), $result);
+ $this->assertSame(array(), $result);
$result = $TestModel->bindModel(array('hasMany' => array('Comment')), false);
$this->assertTrue($result);
4 lib/Cake/Test/Case/Model/ModelWriteTest.php
View
@@ -4536,7 +4536,7 @@ public function testSaveAllValidateFirst() {
$this->assertFalse($result);
$result = $model->find('all');
- $this->assertEquals(array(), $result);
+ $this->assertSame(array(), $result);
$expected = array('Comment' => array(
1 => array('comment' => array('This field cannot be left blank'))
));
@@ -5940,7 +5940,7 @@ public function testSaveAssociatedValidateFirst() {
$this->assertFalse($result);
$result = $model->find('all');
- $this->assertEquals(array(), $result);
+ $this->assertSame(array(), $result);
$expected = array('Comment' => array(
1 => array('comment' => array('This field cannot be left blank'))
));
6 lib/Cake/Test/Case/Routing/RouterTest.php
View
@@ -111,7 +111,7 @@ public function testMapResources() {
$_SERVER['REQUEST_METHOD'] = 'GET';
$result = Router::parse('/posts/add');
- $this->assertEquals(array(), $result);
+ $this->assertSame(array(), $result);
Router::reload();
$resources = Router::mapResources('Posts', array('id' => '[a-z0-9_]+'));
@@ -1907,7 +1907,7 @@ public function testParsingWithPatternOnAction() {
$this->assertEquals($expected, $result);
$result = Router::parse('/blog/foobar');
- $this->assertEquals(array(), $result);
+ $this->assertSame(array(), $result);
$result = Router::url(array('controller' => 'blog_posts', 'action' => 'foo'));
$this->assertEquals('/blog_posts/foo', $result);
@@ -2117,7 +2117,7 @@ public function testRegexRouteMatching() {
$this->assertEquals($expected, $result);
$result = Router::parse('/badness/test/test_action');
- $this->assertEquals(array(), $result);
+ $this->assertSame(array(), $result);
Router::reload();
Router::connect('/:locale/:controller/:action/*', array(), array('locale' => 'dan|eng'));
2  lib/Cake/Test/Case/Utility/SetTest.php
View
@@ -1967,7 +1967,7 @@ public function testCombine() {
$this->assertEquals($expected, $result);
$result = Set::combine($a, 'fail', 'fail');
- $this->assertEquals(array(), $result);
+ $this->assertSame(array(), $result);
}
/**
2  lib/Cake/Test/Case/View/Helper/JsHelperTest.php
View
@@ -904,7 +904,7 @@ public function testObject() {
public function testOptionMapping() {
$JsEngine = new OptionEngineHelper($this->View);
$result = $JsEngine->testMap();
- $this->assertEquals(array(), $result);
+ $this->assertSame(array(), $result);
$result = $JsEngine->testMap(array('foo' => 'bar', 'baz' => 'sho'));
$this->assertEquals(array('foo' => 'bar', 'baz' => 'sho'), $result);
Please sign in to comment.
Something went wrong with that request. Please try again.