function InstalledPackagesListTest::testImmutability

@covers ::offsetSet @covers ::offsetUnset @covers ::append @covers ::exchangeArray

@testWith ["offsetSet", ["new", "thing"]] ["offsetUnset", ["existing"]] ["append", ["new thing"]] ["exchangeArray", [{"evil": "twin"}]]

File

core/modules/package_manager/tests/src/Unit/InstalledPackagesListTest.php, line 29

Class

InstalledPackagesListTest
@coversDefaultClass \Drupal\package_manager\InstalledPackagesList

Namespace

Drupal\Tests\package_manager\Unit

Code

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.