PHPUnit_Framework_Constraint_IsInstanceOf::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 $other instanceof $this->className;
    }

Usage Example

Esempio n. 1
0
 public function testConstraintIsInstanceOf()
 {
     $constraint = new PHPUnit_Framework_Constraint_IsInstanceOf('Exception');
     $this->assertFalse($constraint->evaluate(new stdClass()));
     $this->assertTrue($constraint->evaluate(new Exception()));
     $this->assertEquals('is instance of class "Exception"', $constraint->toString());
     try {
         $constraint->fail(new stdClass(), '');
     } catch (PHPUnit_Framework_ExpectationFailedException $e) {
         $this->assertEquals('Failed asserting that <stdClass> is an instance of class "Exception".', $e->getDescription());
         return;
     }
     $this->fail();
 }
All Usage Examples Of PHPUnit_Framework_Constraint_IsInstanceOf::evaluate
PHPUnit_Framework_Constraint_IsInstanceOf