lithium\test\Unit::assertClassNotHasStaticAttribute()

public method

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

$this->assertClassNotHasStaticAttribute('foobar', '\lithium\core\StaticObject'); // succeeds
$this->assertClassNotHasStaticAttribute('_methodFilters', '\lithium\core\StaticObject'); // fails

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, array(
				'expected' => $attrName,
				'result' => $object->getProperties()
			));
		}
		return $this->assert(true, $message, array(
			'expected' => $attrName,
			'result' => $object->getProperties()
		));
	}