public function testFailureIsIdentical2() { $a = new stdClass(); $b = new stdClass(); $constraint = new PHPUnit_Framework_Constraint_IsIdentical($a); try { $constraint->fail($b, 'custom message'); } catch (PHPUnit_Framework_ExpectationFailedException $e) { $this->assertEquals("custom message\nFailed asserting that two variables reference the same object.\n", PHPUnit_Framework_TestFailure::exceptionToString($e)); return; } $this->fail(); }
public function testConstraintIsIdentical2() { $a = new stdClass(); $b = new stdClass(); $constraint = new PHPUnit_Framework_Constraint_IsIdentical($a); try { $constraint->fail($b, 'custom message'); } catch (PHPUnit_Framework_ExpectationFailedException $e) { $this->assertEquals("custom message\nFailed asserting that \nstdClass Object\n(\n)\n is identical to \nstdClass Object\n(\n)\n.", $e->getDescription()); return; } $this->fail(); }
public function testConstraintIsIdentical() { $a = new stdClass(); $b = new stdClass(); $constraint = new PHPUnit_Framework_Constraint_IsIdentical($a); $this->assertFalse($constraint->evaluate($b)); $this->assertTrue($constraint->evaluate($a)); $this->assertEquals("is identical to \nstdClass Object\n(\n)\n", $constraint->toString()); try { $constraint->fail($b, ''); } catch (PHPUnit_Framework_ExpectationFailedException $e) { $this->assertEquals("Failed asserting that \nstdClass Object\n(\n)\n is identical to \nstdClass Object\n(\n)\n.", $e->getDescription()); return; } $this->fail(); }