public static function PHPUnit_Framework_Assert::assertArrayNotHasKey

Asserts that an array does not have a specified key.

@since Method available since Release 3.0.0

Parameters

mixed $key:

array|ArrayAccess $array:

string $message:

6 calls to PHPUnit_Framework_Assert::assertArrayNotHasKey()
Framework_AssertTest::testAssertArrayNotHasIntegerKey in drupal/core/vendor/phpunit/phpunit/Tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertArrayNotHasKey
Framework_AssertTest::testAssertArrayNotHasKeyAcceptsArrayAccessValue in drupal/core/vendor/phpunit/phpunit/Tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertArrayNotHasKey
Framework_AssertTest::testAssertArrayNotHasKeyPropertlyFailsWithArrayAccessValue in drupal/core/vendor/phpunit/phpunit/Tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertArrayNotHasKey @expectedException PHPUnit_Framework_AssertionFailedError
Framework_AssertTest::testAssertArrayNotHasKeyThrowsException in drupal/core/vendor/phpunit/phpunit/Tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertArrayNotHasKey @expectedException PHPUnit_Framework_Exception
Framework_AssertTest::testAssertArrayNotHasStringKey in drupal/core/vendor/phpunit/phpunit/Tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertArrayNotHasKey

... See full list

File

drupal/core/vendor/phpunit/phpunit/PHPUnit/Framework/Assert.php, line 98

Class

PHPUnit_Framework_Assert
A set of assert methods.

Code

public static function assertArrayNotHasKey($key, $array, $message = '') {
  if (!(is_integer($key) || is_string($key))) {
    throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'integer or string');
  }
  if (!(is_array($array) || $array instanceof ArrayAccess)) {
    throw PHPUnit_Util_InvalidArgumentHelper::factory(2, 'array or ArrayAccess');
  }
  $constraint = new PHPUnit_Framework_Constraint_Not(new PHPUnit_Framework_Constraint_ArrayHasKey($key));
  self::assertThat($array, $constraint, $message);
}