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

InstalledPackagesListTest
Tests 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.