lithium\test\Unit::assertClassHasStaticAttribute()

public method

Assert that a class does have a given static attribute.

$this->assertClassHasStaticAttribute('_methodFilters', '\my_app\SomeClass');
$this->assertClassHasStaticAttribute('foobar', '\my_app\SomeClass');

Parameters

  • mixed $attributeName
  • string $class
  • string|boolean $message

Returns

boolean

true if the assertion succeeded, false otherwise.

Source

	public function assertClassHasStaticAttribute($attributeName, $class, $message = '{:message}') {
		$object = new ReflectionClass($class);

		if ($object->hasProperty($attributeName)) {
			$attribute = $object->getProperty($attributeName);

			return $this->assert($attribute->isStatic(), $message, [
				'expected' => $attributeName,
				'result' => $object->getProperties()
			]);
		}
		return $this->assert(false, $message, [
			'expected' => $attributeName,
			'result' => $object->getProperties()
		]);
	}