Example #1
0
 public function testConstraintIsType2()
 {
     $constraint = new PHPUnit_Framework_Constraint_IsType('string');
     try {
         $constraint->fail(new stdClass(), 'custom message');
     } catch (PHPUnit_Framework_ExpectationFailedException $e) {
         $this->assertEquals("custom message\nFailed asserting that \nstdClass Object\n(\n)\n is of type \"string\".", $e->getDescription());
         return;
     }
     $this->fail();
 }
Example #2
0
 public function testConstraintIsType()
 {
     $constraint = new PHPUnit_Framework_Constraint_IsType('string');
     $this->assertFalse($constraint->evaluate(0));
     $this->assertTrue($constraint->evaluate(''));
     $this->assertEquals('is of type "string"', $constraint->toString());
     try {
         $constraint->fail(new stdClass(), '');
     } catch (PHPUnit_Framework_ExpectationFailedException $e) {
         $this->assertEquals("Failed asserting that \nstdClass Object\n(\n)\n is of type \"string\".", $e->getDescription());
         return;
     }
     $this->fail();
 }