lithium\test\Unit::assertClassNotHasStaticAttribute()

public method

Assert that a class does not have a given static attribute.

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

Parameters

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

Returns

boolean

true if the assertion succeeded, false otherwise.

Source

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

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

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