class PHPUnit_Framework_Constraint_ObjectHasAttribute in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/phpunit/phpunit/src/Framework/Constraint/ObjectHasAttribute.php \PHPUnit_Framework_Constraint_ObjectHasAttribute
Constraint that asserts that the object it is evaluated for has a given attribute.
The attribute name is passed in the constructor.
@since Class available since Release 3.0.0
Hierarchy
- class \PHPUnit_Framework_Constraint implements \Countable, PHPUnit_Framework_SelfDescribing
Expanded class hierarchy of PHPUnit_Framework_Constraint_ObjectHasAttribute
File
- vendor/
phpunit/ phpunit/ src/ Framework/ Constraint/ ObjectHasAttribute.php, line 19
View source
class PHPUnit_Framework_Constraint_ObjectHasAttribute extends PHPUnit_Framework_Constraint_ClassHasAttribute {
/**
* Evaluates the constraint for parameter $other. Returns true if the
* constraint is met, false otherwise.
*
* @param mixed $other Value or object to evaluate.
* @return bool
*/
protected function matches($other) {
$object = new ReflectionObject($other);
return $object
->hasProperty($this->attributeName);
}
}