PHPUnit_Framework_Assert::assertClassHasStaticAttribute PHP Method

assertClassHasStaticAttribute() public static method

Asserts that a class has a specified static attribute.
public static assertClassHasStaticAttribute ( string $attributeName, string $className, string $message = '' )
$attributeName string
$className string
$message string
    public static function assertClassHasStaticAttribute($attributeName, $className, $message = '')
    {
        if (!is_string($attributeName)) {
            throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
        }
        if (!preg_match('/[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*/', $attributeName)) {
            throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'valid attribute name');
        }
        if (!is_string($className) || !class_exists($className)) {
            throw PHPUnit_Util_InvalidArgumentHelper::factory(2, 'class name', $className);
        }
        $constraint = new PHPUnit_Framework_Constraint_ClassHasStaticAttribute($attributeName);
        static::assertThat($className, $constraint, $message);
    }

Usage Example

Esempio n. 1
0
 public function hasStaticAttribute($attribute)
 {
     a::assertClassHasStaticAttribute($attribute, $this->actual, $this->description);
 }
All Usage Examples Of PHPUnit_Framework_Assert::assertClassHasStaticAttribute
PHPUnit_Framework_Assert