You are here

public static function PHPUnit_Framework_Assert::assertObjectNotHasAttribute in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpunit/phpunit/src/Framework/Assert.php \PHPUnit_Framework_Assert::assertObjectNotHasAttribute()

Asserts that an object does not have a specified attribute.

@since Method available since Release 3.0.0

Parameters

string $attributeName:

object $object:

string $message:

9 calls to PHPUnit_Framework_Assert::assertObjectNotHasAttribute()
Framework_AssertTest::testAssertObjectNotHasAttribute in vendor/phpunit/phpunit/tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertObjectNotHasAttribute
Framework_AssertTest::testAssertObjectNotHasAttributeThrowsException in vendor/phpunit/phpunit/tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertObjectNotHasAttribute @expectedException PHPUnit_Framework_Exception
Framework_AssertTest::testAssertObjectNotHasAttributeThrowsException2 in vendor/phpunit/phpunit/tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertObjectNotHasAttribute @expectedException PHPUnit_Framework_Exception
Framework_AssertTest::testAssertObjectNotHasAttributeThrowsExceptionIfAttributeNameIsNotValid in vendor/phpunit/phpunit/tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertObjectNotHasAttribute @expectedException PHPUnit_Framework_Exception
Framework_AssertTest::testObjectNotHasOnTheFlyAttribute in vendor/phpunit/phpunit/tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertObjectNotHasAttribute

... See full list

File

vendor/phpunit/phpunit/src/Framework/Assert.php, line 1135

Class

PHPUnit_Framework_Assert
A set of assert methods.

Code

public static function assertObjectNotHasAttribute($attributeName, $object, $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_object($object)) {
    throw PHPUnit_Util_InvalidArgumentHelper::factory(2, 'object');
  }
  $constraint = new PHPUnit_Framework_Constraint_Not(new PHPUnit_Framework_Constraint_ObjectHasAttribute($attributeName));
  self::assertThat($object, $constraint, $message);
}