lithium\test\Unit::assertObjectNotHasAttribute()
Assert that $object
does not have given attribute.
$this->assertObjectNotHasAttribute('name', 'ReflectionClass'); // succeeds
$this->assertObjectNotHasAttribute('__construct', 'ReflectionClass'); // fails
Parameters
-
string
$attributeName
-
string
$object
-
string|boolean
$message
Returns
booleantrue
if the assertion succeeded, false
otherwise.
Source
public function assertObjectNotHasAttribute($attributeName, $object, $message = '{:message}') {
if (!is_object($object)) {
throw new InvalidArgumentException('Second argument $object must be an object');
}
$object = new ReflectionClass($object);
return $this->assert(!$object->hasProperty($attributeName), $message, [
'expected' => $attributeName,
'result' => $object->getProperties()
]);
}