Improving tests for Set::diff

This commit is contained in:
José Lorenzo Rodríguez 2010-01-31 20:26:57 -04:30
parent a89d9e4830
commit aadf62de6e

View file

@ -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);
}
/**