public function testFailureArrayHasKey2() { $constraint = new PHPUnit_Framework_Constraint_ArrayHasKey(0); try { $constraint->fail(array(), 'custom message'); } catch (PHPUnit_Framework_ExpectationFailedException $e) { $this->assertEquals("custom message\nFailed asserting that an array has the key <integer:0>.\n", PHPUnit_Framework_TestFailure::exceptionToString($e)); return; } $this->fail(); }
public function testConstraintArrayHasKey2() { $constraint = new PHPUnit_Framework_Constraint_ArrayHasKey(0); try { $constraint->fail(array(), 'custom message'); } catch (PHPUnit_Framework_ExpectationFailedException $e) { $this->assertEquals("custom message\nFailed asserting that \nArray\n(\n)\n has key <integer:0>.", $e->getDescription()); return; } $this->fail(); }
public function testConstraintArrayHasKey() { $constraint = new PHPUnit_Framework_Constraint_ArrayHasKey(0); $this->assertFalse($constraint->evaluate(array())); $this->assertEquals('has key <integer:0>', $constraint->toString()); try { $constraint->fail(array(), ''); } catch (PHPUnit_Framework_ExpectationFailedException $e) { $this->assertEquals("Failed asserting that \nArray\n(\n)\n has key <integer:0>.", $e->getDescription()); return; } $this->fail(); }