fail() public méthode

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.
Exemple #1
0
 public function testFailureTraversableNotContains2()
 {
     $constraint = new PHPUnit_Framework_Constraint_Not(new PHPUnit_Framework_Constraint_TraversableContains('foo'));
     try {
         $constraint->fail(array('foo'), 'custom message', TRUE);
     } catch (PHPUnit_Framework_ExpectationFailedException $e) {
         $this->assertEquals("custom message\nFailed asserting that an array does not contain <string:foo>.\n", PHPUnit_Framework_TestFailure::exceptionToString($e));
         return;
     }
     $this->fail();
 }
 public function testConstraintTraversableNotContains2()
 {
     $constraint = new PHPUnit_Framework_Constraint_Not(new PHPUnit_Framework_Constraint_TraversableContains('foo'));
     try {
         $constraint->fail(array('foo'), 'custom message');
     } catch (PHPUnit_Framework_ExpectationFailedException $e) {
         $this->assertEquals("custom message\nFailed asserting that \nArray\n(\n    [0] => foo\n)\n does not contain <string:foo>.", $e->getDescription());
         return;
     }
     $this->fail();
 }
 public function testConstraintTraversableNotContains()
 {
     $constraint = new PHPUnit_Framework_Constraint_Not(new PHPUnit_Framework_Constraint_TraversableContains('foo'));
     $this->assertTrue($constraint->evaluate(array('bar')));
     $this->assertFalse($constraint->evaluate(array('foo')));
     $this->assertEquals('does not contain <string:foo>', $constraint->toString());
     try {
         $constraint->fail(array('foo'), '');
     } catch (PHPUnit_Framework_ExpectationFailedException $e) {
         $this->assertEquals("Failed asserting that \nArray\n(\n    [0] => foo\n)\n does not contain <string:foo>.", $e->getDescription());
         return;
     }
     $this->fail();
 }