You are here

public static function PHPUnit_Framework_Assert::assertArraySubset in Zircon Profile 8

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

Asserts that an array has a specified subset.

@since Method available since Release 4.4.0

Parameters

array|ArrayAccess $subset:

array|ArrayAccess $array:

bool $strict Check for object identity:

string $message:

7 calls to PHPUnit_Framework_Assert::assertArraySubset()
Framework_AssertTest::testAssertArraySubset in vendor/phpunit/phpunit/tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertArraySubset @covers PHPUnit_Framework_Constraint_ArraySubset
Framework_AssertTest::testAssertArraySubsetRaisesExceptionForInvalidArguments in vendor/phpunit/phpunit/tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertArraySubset @covers PHPUnit_Framework_Constraint_ArraySubset @expectedException PHPUnit_Framework_Exception @expectedExceptionMessage array or ArrayAccess @dataProvider assertArraySubsetInvalidArgumentProvider
Framework_AssertTest::testAssertArraySubsetWithDeepNestedArrays in vendor/phpunit/phpunit/tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertArraySubset @covers PHPUnit_Framework_Constraint_ArraySubset
Framework_AssertTest::testAssertArraySubsetWithNoStrictCheckAndObjects in vendor/phpunit/phpunit/tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertArraySubset @covers PHPUnit_Framework_Constraint_ArraySubset
Framework_AssertTest::testAssertArraySubsetWithStrictCheckAndObjects in vendor/phpunit/phpunit/tests/Framework/AssertTest.php
@covers PHPUnit_Framework_Assert::assertArraySubset @covers PHPUnit_Framework_Constraint_ArraySubset

... See full list

File

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

Class

PHPUnit_Framework_Assert
A set of assert methods.

Code

public static function assertArraySubset($subset, $array, $strict = false, $message = '') {
  if (!is_array($subset)) {
    throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'array or ArrayAccess');
  }
  if (!is_array($array)) {
    throw PHPUnit_Util_InvalidArgumentHelper::factory(2, 'array or ArrayAccess');
  }
  $constraint = new PHPUnit_Framework_Constraint_ArraySubset($subset, $strict);
  self::assertThat($array, $constraint, $message);
}