public function Framework_AssertTest::testAssertArraySubset in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/phpunit/phpunit/tests/Framework/AssertTest.php \Framework_AssertTest::testAssertArraySubset()
@covers PHPUnit_Framework_Assert::assertArraySubset @covers PHPUnit_Framework_Constraint_ArraySubset
File
- vendor/
phpunit/ phpunit/ tests/ Framework/ AssertTest.php, line 173
Class
- Framework_AssertTest
- @since Class available since Release 2.0.0
Code
public function testAssertArraySubset() {
$array = array(
'a' => 'item a',
'b' => 'item b',
'c' => array(
'a2' => 'item a2',
'b2' => 'item b2',
),
'd' => array(
'a2' => array(
'a3' => 'item a3',
'b3' => 'item b3',
),
),
);
$this
->assertArraySubset(array(
'a' => 'item a',
'c' => array(
'a2' => 'item a2',
),
), $array);
$this
->assertArraySubset(array(
'a' => 'item a',
'd' => array(
'a2' => array(
'b3' => 'item b3',
),
),
), $array);
try {
$this
->assertArraySubset(array(
'a' => 'bad value',
), $array);
} catch (PHPUnit_Framework_AssertionFailedError $e) {
}
try {
$this
->assertArraySubset(array(
'd' => array(
'a2' => array(
'bad index' => 'item b3',
),
),
), $array);
} catch (PHPUnit_Framework_AssertionFailedError $e) {
return;
}
$this
->fail();
}