public function CorePackageManifestTest::testCorePackagesMatchManifest in Automatic Updates 8.2
Tests that detected core packages match our hard-coded manifest file.
File
- package_manager/
tests/ src/ Kernel/ CorePackageManifestTest.php, line 28
Class
- CorePackageManifestTest
- Tests that core's Composer packages are properly accounted for.
Namespace
Drupal\Tests\package_manager\KernelCode
public function testCorePackagesMatchManifest() : void {
// Scan for all the composer.json files of said metapackages and plugins,
// ignoring the project templates. If we are not running in git clone of
// Drupal core, this will fail since the 'composer' directory won't exist.
$finder = Finder::create()
->in($this
->getDrupalRoot() . '/composer')
->name('composer.json')
->notPath('Template');
// Always consider drupal/core a valid core package, even though it's not a
// metapackage or plugin.
$packages = [
'drupal/core',
];
foreach ($finder as $file) {
$data = Json::decode($file
->getContents());
$packages[] = $data['name'];
}
sort($packages);
// Ensure that the packages we detected matches the hard-coded list we ship.
$manifest = file_get_contents(__DIR__ . '/../../../core_packages.json');
$manifest = Json::decode($manifest);
$this
->assertSame($packages, $manifest);
}