function InstalledPackagesListTrait::assertPackageListsEqual
Asserts that 2 installed package lists are equal.
Parameters
\Drupal\package_manager\InstalledPackagesList $expected_list: The expected list.
\Drupal\package_manager\InstalledPackagesList $actual_list: The actual list.
3 calls to InstalledPackagesListTrait::assertPackageListsEqual()
- ComposerInspectorTest::testGetInstalledPackagesList in core/
modules/ package_manager/ tests/ src/ Kernel/ ComposerInspectorTest.php - @covers ::getInstalledPackagesList
- FixtureManipulatorTest::testAddPackage in core/
modules/ package_manager/ tests/ src/ Kernel/ FixtureManipulatorTest.php - @covers ::addPackage
- FixtureManipulatorTest::testRemovePackage in core/
modules/ package_manager/ tests/ src/ Kernel/ FixtureManipulatorTest.php - @covers ::removePackage
File
-
core/
modules/ package_manager/ tests/ src/ Traits/ InstalledPackagesListTrait.php, line 28
Class
- InstalledPackagesListTrait
- A trait for comparing InstalledPackagesList objects.
Namespace
Drupal\Tests\package_manager\TraitsCode
private function assertPackageListsEqual(InstalledPackagesList $expected_list, InstalledPackagesList $actual_list) : void {
$expected_array = $expected_list->getArrayCopy();
$actual_array = $actual_list->getArrayCopy();
ksort($expected_array);
ksort($actual_array);
$this->assertSame(array_keys($expected_array), array_keys($actual_array));
foreach ($expected_list as $package_name => $expected_package) {
$this->assertInstanceOf(InstalledPackage::class, $expected_package);
$actual_package = $actual_list[$package_name];
$this->assertInstanceOf(InstalledPackage::class, $actual_package);
$this->assertSame($expected_package->name, $actual_package->name);
$this->assertSame($expected_package->version, $actual_package->version);
$this->assertSame($expected_package->path, $actual_package->path);
$this->assertSame($expected_package->type, $actual_package->type);
$this->assertSame($expected_package->getProjectName(), $actual_package->getProjectName());
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.