mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-67673 phpunit: Remove deprecated assertArraySubset()
While this is not strictly required, because removal will happen in PHPUnit 9.0, we are already getting rid of all uses in core. From release notes:https://phpunit.de/announcements/phpunit-8.html assertArraySubset() is deprecated and will be removed in PHPUnit 9.
This commit is contained in:
parent
f94195c320
commit
598d578af7
@ -3567,9 +3567,12 @@ class core_accesslib_testcase extends advanced_testcase {
|
||||
protected function assert_capability_list_contains($expected, $actual) {
|
||||
$actualnames = [];
|
||||
foreach ($actual as $cap) {
|
||||
$actualnames[$cap->name] = $cap->name;
|
||||
$actualnames[] = $cap->name;
|
||||
}
|
||||
// Verify each expected element exists.
|
||||
foreach ($expected as $key => $value) {
|
||||
$this->assertContains($value, $actualnames);
|
||||
}
|
||||
$this->assertArraySubset(array_combine($expected, $expected), $actualnames);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -48,8 +48,12 @@ class gradeitems_test extends advanced_testcase {
|
||||
$mappings = component_gradeitems::get_itemname_mapping_for_component('mod_forum');
|
||||
$this->assertIsArray($mappings);
|
||||
$this->assertCount(2, $mappings);
|
||||
$this->assertArraySubset([0 => 'rating'], $mappings);
|
||||
$this->assertArraySubset([1 => 'forum'], $mappings);
|
||||
$expected = [0 => 'rating', 1 => 'forum'];
|
||||
// Verify each expected element exists and its value matches.
|
||||
foreach ($expected as $key => $value) {
|
||||
$this->assertArrayHasKey($key, $mappings);
|
||||
$this->assertSame($value, $mappings[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user