Example #1
0
 public function testConstraintObjectHasAttribute()
 {
     $constraint = new PHPUnit_Framework_Constraint_ObjectHasAttribute('foo');
     $this->assertFalse($constraint->evaluate(new stdClass()));
     $this->assertEquals('has attribute "foo"', $constraint->toString());
     try {
         $constraint->fail(new stdClass(), '');
     } catch (PHPUnit_Framework_ExpectationFailedException $e) {
         $this->assertEquals("Failed asserting that \nstdClass Object\n(\n)\n has attribute \"foo\".", $e->getDescription());
         return;
     }
     $this->fail();
 }