Loading package_manager/tests/fixtures/fake_site/vendor/composer/installed.json +5 −2 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ { "name": "drupal/core", "version": "9.8.0", "type": "drupal-core", "extra": { "drupal-scaffold": { "file-mapping": { Loading @@ -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": [] Loading package_manager/tests/fixtures/fake_site/vendor/composer/installed.php +1 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ return [ 'versions' => [ 'drupal/core' => [ 'name' => 'drupal/core', 'type' => 'drupal-core', ], ], ]; package_manager/tests/src/Kernel/FakeSiteFixtureTest.php +17 −0 Original line number Diff line number Diff line Loading @@ -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. * Loading @@ -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')); } } package_manager/tests/src/Kernel/FixtureUtilityTraitTest.php +12 −2 Original line number Diff line number Diff line Loading @@ -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); } Loading Loading @@ -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); } Loading Loading
package_manager/tests/fixtures/fake_site/vendor/composer/installed.json +5 −2 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ { "name": "drupal/core", "version": "9.8.0", "type": "drupal-core", "extra": { "drupal-scaffold": { "file-mapping": { Loading @@ -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": [] Loading
package_manager/tests/fixtures/fake_site/vendor/composer/installed.php +1 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ return [ 'versions' => [ 'drupal/core' => [ 'name' => 'drupal/core', 'type' => 'drupal-core', ], ], ];
package_manager/tests/src/Kernel/FakeSiteFixtureTest.php +17 −0 Original line number Diff line number Diff line Loading @@ -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. * Loading @@ -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')); } }
package_manager/tests/src/Kernel/FixtureUtilityTraitTest.php +12 −2 Original line number Diff line number Diff line Loading @@ -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); } Loading Loading @@ -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); } Loading