PHPUnit_Framework_Constraint_Not::evaluate PHP Method

evaluate() public method

Evaluates the constraint for parameter $other. Returns TRUE if the constraint is met, FALSE otherwise.
public evaluate ( mixed $other ) : boolean
$other mixed Value or object to evaluate.
return boolean
    public function evaluate($other)
    {
        return !$this->constraint->evaluate($other);
    }

Usage Example

Ejemplo n.º 1
0
 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();
 }