public function isnt(LimeTesterInterface $expected) { // don't compare twice to allow for cyclic dependencies if (in_array(array($this->value, $expected->value), self::$unequal, true) || in_array(array($expected->value, $this->value), self::$unequal, true)) { return; } self::$unequal[] = array($this->value, $expected->value); parent::isnt($expected); }
// fixtures $actual = new LimeTesterArray(array('a' => 1, 'b' => 2)); $expected = new LimeTesterArray(array('b' => 2, 'a' => 1)); // test $actual->isntSame($expected); // @Test: contains() throws an exception if a value is not in the array // fixtures $actual = new LimeTesterArray(array(0 => 1)); $expected = LimeTester::create(0); // test $t->expect('LimeAssertionFailedException'); $actual->contains($expected); // @Test: contains() throws no exception if a value is in the array // fixtures $actual = new LimeTesterArray(array(0 => 1)); $expected = LimeTester::create(1); // test $actual->contains($expected); // @Test: containsNot() throws an exception if a value is in the array // fixtures $actual = new LimeTesterArray(array(0 => 1)); $expected = LimeTester::create(1); // test $t->expect('LimeAssertionFailedException'); $actual->containsNot($expected); // @Test: containsNot() throws no exception if a value is not in the array // fixtures $actual = new LimeTesterArray(array(0 => 1)); $expected = LimeTester::create(0); // test $actual->containsNot($expected);
$actual->same($expected); // @Test: isntSame() throws no exception when comparing arrays with scalars (1) // fixtures $actual = new LimeTesterArray(array()); $expected = new LimeTesterScalar(false); // test $actual->isntSame($expected); // @Test: isntSame() throws no exception when comparing arrays with scalars (2) // fixtures $actual = new LimeTesterScalar(false); $expected = new LimeTesterArray(array()); // test $actual->isntSame($expected); // @Test: isntSame() throws no exception when comparing arrays with objects (1) // fixtures $actual = new LimeTesterArray(array()); $expected = new LimeTesterObject(new stdClass()); // test $actual->isntSame($expected); // @Test: isntSame() throws no exception when comparing arrays with objects (2) // fixtures $actual = new LimeTesterObject(new stdClass()); $expected = new LimeTesterArray(array()); // test $actual->isntSame($expected); // @Test: isntSame() throws no exception when comparing doubles with strings (1) // fixtures $actual = new LimeTesterDouble(1.0); $expected = new LimeTesterString('1.0'); // test $actual->isntSame($expected);