lithium\test\Unit::assertClassHasAttribute PHP Method

assertClassHasAttribute() public method

$this->assertClassHasAttribute('__construct', 'ReflectionClass'); // succeeds $this->assertClassHasAttribute('name', 'ReflectionClass'); // fails
See also: lithium\test\Unit::assert()
See also: lithium\test\Unit::assertObjectHasAttribute()
public assertClassHasAttribute ( mixed $attributeName, string $class, string | boolean $message = '{:message}' ) : boolean
$attributeName mixed
$class string
$message string | boolean
return boolean `true` if the assertion succeeded, `false` otherwise.
    public function assertClassHasAttribute($attributeName, $class, $message = '{:message}')
    {
        if (!is_string($class)) {
            throw new InvalidArgumentException('Argument $class must be a string');
        }
        $object = new ReflectionClass($class);
        return $this->assert($object->hasProperty($attributeName), $message, array('expected' => $attributeName, 'result' => $object->getProperties()));
    }