function InstalledPackagesListTest::testImmutability
Tests immutability.
@legacy-covers ::offsetSet @legacy-covers ::offsetUnset @legacy-covers ::append @legacy-covers ::exchangeArray
Attributes
#[TestWith([
"offsetSet",
[
"new",
"thing",
],
])]
#[TestWith([
"offsetUnset",
[
"existing",
],
])]
#[TestWith([
"offsetSet",
[
"new",
"thing",
],
])]
#[TestWith([
"exchangeArray",
[
[
"evil" => "twin",
],
],
])]
File
-
core/
modules/ package_manager/ tests/ src/ Unit/ InstalledPackagesListTest.php, line 29
Class
Namespace
Drupal\Tests\package_manager\UnitCode
public function testImmutability(string $method, array $arguments) : void {
$list = new InstalledPackagesList([
'existing' => 'thing',
]);
$this->expectException(\LogicException::class);
$this->expectExceptionMessage('Installed package lists cannot be modified.');
$list->{$method}(...$arguments);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.