You are here

public static function PHPUnit_Framework_Assert::assertArrayNotHasKey in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpunit/phpunit/src/Framework/Assert.php \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:

8 calls to PHPUnit_Framework_Assert::assertArrayNotHasKey()
Framework_AssertTest::testAssertArrayNotHasIntegerKey in vendor/phpunit/phpunit/tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertArrayNotHasKey
Framework_AssertTest::testAssertArrayNotHasKeyAcceptsArrayAccessValue in vendor/phpunit/phpunit/tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertArrayNotHasKey
Framework_AssertTest::testAssertArrayNotHasKeyPropertlyFailsWithArrayAccessValue in vendor/phpunit/phpunit/tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertArrayNotHasKey @expectedException PHPUnit_Framework_AssertionFailedError
Framework_AssertTest::testAssertArrayNotHasKeyThrowsExceptionForInvalidFirstArgument in vendor/phpunit/phpunit/tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertArrayNotHasKey @expectedException PHPUnit_Framework_Exception
Framework_AssertTest::testAssertArrayNotHasKeyThrowsExceptionForInvalidSecondArgument in vendor/phpunit/phpunit/tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertArrayNotHasKey @expectedException PHPUnit_Framework_Exception

... See full list

File

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

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);
}