mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Improving tests for Set::diff
This commit is contained in:
parent
a89d9e4830
commit
aadf62de6e
1 changed files with 42 additions and 1 deletions
|
@ -1032,7 +1032,7 @@ class SetTest extends CakeTestCase {
|
|||
|
||||
/**
|
||||
* testExtractWithArrays method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -1456,6 +1456,47 @@ class SetTest extends CakeTestCase {
|
|||
0 => array('name' => 'main')
|
||||
);
|
||||
$this->assertIdentical($result, $expected);
|
||||
|
||||
$a = array();
|
||||
$b = array('name' => 'bob', 'address' => 'home');
|
||||
$result = Set::diff($a, $b);
|
||||
$this->assertIdentical($result, $b);
|
||||
|
||||
|
||||
$a = array('name' => 'bob', 'address' => 'home');
|
||||
$b = array();
|
||||
$result = Set::diff($a, $b);
|
||||
$this->assertIdentical($result, $a);
|
||||
|
||||
$a = array('key' => true, 'another' => false, 'name' => 'me');
|
||||
$b = array('key' => 1, 'another' => 0);
|
||||
$expected = array('name' => 'me');
|
||||
$result = Set::diff($a, $b);
|
||||
$this->assertIdentical($result, $expected);
|
||||
|
||||
$a = array('key' => 'value', 'another' => null, 'name' => 'me');
|
||||
$b = array('key' => 'differentValue', 'another' => null);
|
||||
$expected = array('key' => 'value', 'name' => 'me');
|
||||
$result = Set::diff($a, $b);
|
||||
$this->assertIdentical($result, $expected);
|
||||
|
||||
$a = array('key' => 'value', 'another' => null, 'name' => 'me');
|
||||
$b = array('key' => 'differentValue', 'another' => 'value');
|
||||
$expected = array('key' => 'value', 'another' => null, 'name' => 'me');
|
||||
$result = Set::diff($a, $b);
|
||||
$this->assertIdentical($result, $expected);
|
||||
|
||||
$a = array('key' => 'value', 'another' => null, 'name' => 'me');
|
||||
$b = array('key' => 'differentValue', 'another' => 'value');
|
||||
$expected = array('key' => 'differentValue', 'another' => 'value', 'name' => 'me');
|
||||
$result = Set::diff($b, $a);
|
||||
$this->assertIdentical($result, $expected);
|
||||
|
||||
$a = array('key' => 'value', 'another' => null, 'name' => 'me');
|
||||
$b = array(0 => 'differentValue', 1 => 'value');
|
||||
$expected = $a + $b;
|
||||
$result = Set::diff($a, $b);
|
||||
$this->assertIdentical($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue