lithium\test\Unit::assertClassNotHasStaticAttribute()

public method

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

$this->assertClassNotHasStaticAttribute('foobar', '\lithium\core\StaticObjectDeprecated'); // succeeds
$this->assertClassNotHasStaticAttribute('_methodFilters', '\lithium\core\StaticObjectDeprecated'); // 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, [
				'expected' => $attrName,
				'result' => $object->getProperties()
			]);
		}
		return $this->assert(true, $message, [
			'expected' => $attrName,
			'result' => $object->getProperties()
		]);
	}