function FakeSiteFixtureTest::testCallToSetVersion
Tests if `setVersion` can be called on all packages in the fixture.
See also
\Drupal\fixture_manipulator\FixtureManipulator::setVersion()
File
-
core/
modules/ package_manager/ tests/ src/ Kernel/ FakeSiteFixtureTest.php, line 48
Class
- FakeSiteFixtureTest
- Test that the 'fake-site' fixture is a valid starting point.
Namespace
Drupal\Tests\package_manager\KernelCode
public function testCallToSetVersion() : void {
/** @var \Drupal\package_manager\ComposerInspector $inspector */
$inspector = $this->container
->get(ComposerInspector::class);
$active_dir = $this->container
->get(PathLocator::class)
->getProjectRoot();
$installed_packages = $inspector->getInstalledPackagesList($active_dir);
foreach (self::getExpectedFakeSitePackages() as $package_name) {
$this->assertArrayHasKey($package_name, $installed_packages);
$this->assertSame($installed_packages[$package_name]->version, '9.8.0');
(new ActiveFixtureManipulator())->setVersion($package_name, '11.1.0')
->commitChanges();
$list = $inspector->getInstalledPackagesList($active_dir);
$this->assertSame($list[$package_name]?->version, '11.1.0');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.