Skip to content

Commit 6844697

Browse files
guidocellaDavertMik
authored andcommitted
Add assertArraySubset (#4392)
1 parent 7049491 commit 6844697

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/Codeception/Module/Asserts.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,19 @@ public function assertArrayNotHasKey($key, $actual, $description = '')
345345
parent::assertArrayNotHasKey($key, $actual, $description);
346346
}
347347

348+
/**
349+
* Checks that array contains subset.
350+
*
351+
* @param array $subset
352+
* @param array $array
353+
* @param bool $strict
354+
* @param string $message
355+
*/
356+
public function assertArraySubset($subset, $array, $strict = false, $message = '')
357+
{
358+
parent::assertArraySubset($subset, $array, $strict, $message);
359+
}
360+
348361
/**
349362
* @param $expectedCount
350363
* @param $actual

tests/unit/Codeception/Module/AssertsTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public function testAsserts()
2525
$module->assertInstanceOf('Exception', new Exception());
2626
$module->assertInternalType('integer', 5);
2727
$module->assertArrayHasKey('one', ['one' => 1, 'two' => 2]);
28+
$module->assertArraySubset(['foo' => [1]], ['foo' => [1, 2]]);
2829
$module->assertCount(3, [1, 2, 3]);
2930
}
3031

0 commit comments

Comments
 (0)