fail() public method

public fail ( mixed $other, string $description, boolean $not = FALSE )
$other mixed The value passed to evaluate() which failed the constraint check.
$description string A string with extra description of what was going on while the evaluation failed.
$not boolean Flag to indicate negation.
Beispiel #1
0
 public function testFailureIsEqual2()
 {
     $constraint = new PHPUnit_Framework_Constraint_IsEqual(1);
     try {
         $constraint->fail(0, 'custom message');
     } catch (PHPUnit_Framework_ExpectationFailedException $e) {
         $this->assertEquals("custom message\nFailed asserting that <integer:0> matches expected value <integer:1>.\n", PHPUnit_Framework_TestFailure::exceptionToString($e));
         return;
     }
     $this->fail();
 }
 public function testConstraintIsEqual2()
 {
     $constraint = new PHPUnit_Framework_Constraint_IsEqual(1);
     try {
         $constraint->fail(0, 'custom message');
     } catch (PHPUnit_Framework_ExpectationFailedException $e) {
         $this->assertEquals("custom message\nFailed asserting that <integer:0> is equal to <integer:1>.", $e->getDescription());
         return;
     }
     $this->fail();
 }
Beispiel #3
0
 public function testConstraintIsEqual()
 {
     $constraint = new PHPUnit_Framework_Constraint_IsEqual(1);
     $this->assertFalse($constraint->evaluate(0));
     $this->assertTrue($constraint->evaluate(1));
     $this->assertEquals('is equal to <integer:1>', $constraint->toString());
     try {
         $constraint->fail(0, '');
     } catch (PHPUnit_Framework_ExpectationFailedException $e) {
         $this->assertEquals("Failed asserting that <integer:0> is equal to <integer:1>.", $e->getDescription());
         return;
     }
     $this->fail();
 }