PHPUnit_Framework_Constraint_IsInstanceOf::toString PHP Method

toString() public method

Returns a string representation of the constraint.
public toString ( ) : string
return string
    public function toString()
    {
        return sprintf('is instance of class "%s"', $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();
 }
PHPUnit_Framework_Constraint_IsInstanceOf