Skip to content
Snippets Groups Projects
Commit 25627ce0 authored by Kunal Sachdev's avatar Kunal Sachdev Committed by Ted Bowman
Browse files

Issue #3320487 by kunal.sachdev, tedbow: fake-site fixtures has invalid packages in composer files

parent e1a0bf4e
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@
{
"name": "drupal/core",
"version": "9.8.0",
"type": "drupal-core",
"extra": {
"drupal-scaffold": {
"file-mapping": {
......@@ -14,11 +15,13 @@
},
{
"name": "drupal/core-recommended",
"version": "9.8.0"
"version": "9.8.0",
"type": "drupal-core"
},
{
"name": "drupal/core-dev",
"version": "9.8.0"
"version": "9.8.0",
"type": "drupal-core"
}
],
"dev-package-names": []
......
......@@ -9,6 +9,7 @@ return [
'versions' => [
'drupal/core' => [
'name' => 'drupal/core',
'type' => 'drupal-core',
],
],
];
......@@ -2,6 +2,8 @@
namespace Drupal\Tests\package_manager\Kernel;
use Drupal\package_manager\ComposerUtility;
/**
* Test that the 'fake-site' fixture is a valid starting point.
*
......@@ -20,4 +22,19 @@ class FakeSiteFixtureTest extends PackageManagerKernelTestBase {
$this->assertStatusCheckResults([]);
}
/**
* Tests calls to ComposerUtility class methods.
*/
public function testCallToComposerUtilityMethods(): void {
$active_dir = $this->container->get('package_manager.path_locator')->getProjectRoot();
$composer_utility = ComposerUtility::createForDirectory($active_dir);
// Although the fake-site fixture does not contain any Composer packages or
// Drupal projects that would be returned from these methods calling them
// and asserting that they return NULL proves there are not any missing
// metadata in the fixture files that would cause these methods to throw an
// exception.
$this->assertNull($composer_utility->getProjectForPackage('any_random_name'));
$this->assertNull($composer_utility->getPackageForProject('drupal/any_random_name'));
}
}
......@@ -97,7 +97,12 @@ class FixtureUtilityTraitTest extends PackageManagerKernelTestBase {
// have been prefixed with the __DIR__ constant, which should be interpreted
// when installed.php is loaded by the PHP runtime.
$installed_php_expected_packages['my/dev-package']['install_path'] = "$this->dir/vendor/composer/../relative/path";
$installed_php_expected_packages = ['drupal/core' => ['name' => 'drupal/core']] + $installed_php_expected_packages;
$installed_php_expected_packages = [
'drupal/core' => [
'name' => 'drupal/core',
'type' => 'drupal-core',
],
] + $installed_php_expected_packages;
$this->assertSame($installed_php_expected_packages, $installed_php);
}
......@@ -183,7 +188,12 @@ class FixtureUtilityTraitTest extends PackageManagerKernelTestBase {
$this->assertContains('my/dev-package', $installed_json['dev-package-names']);
$this->assertNotContains('my/other-package', $installed_json['dev-package-names']);
$this->assertNotContains('my/package', $installed_json['dev-package-names']);
$installed_php_expected_packages = ['drupal/core' => ['name' => 'drupal/core']] + $installed_php_expected_packages;
$installed_php_expected_packages = [
'drupal/core' => [
'name' => 'drupal/core',
'type' => 'drupal-core',
],
] + $installed_php_expected_packages;
// @see ::testAddPackage()
$this->assertSame($installed_php_expected_packages, $installed_php);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment