diff --git a/dictionary.txt b/dictionary.txt index 9c2837bceee4d68fb9a6e84d56f52989855ed931..9071f6cab159e5253679d6ff636a2ec4e739f818 100644 --- a/dictionary.txt +++ b/dictionary.txt @@ -11,3 +11,4 @@ filedate unshallow hhvm proc_open +bootable diff --git a/package_manager/src/Validator/ComposerPluginsValidator.php b/package_manager/src/Validator/ComposerPluginsValidator.php index 4cd11ce467193fe30617e78bb547a6cff629180f..b584da44c857d26bfe197002afb7baf99bb3ab2c 100644 --- a/package_manager/src/Validator/ComposerPluginsValidator.php +++ b/package_manager/src/Validator/ComposerPluginsValidator.php @@ -67,6 +67,7 @@ final class ComposerPluginsValidator implements EventSubscriberInterface { 'cweagans/composer-patches' => '^1.7.3', // @see \Drupal\package_manager\PathExcluder\VendorHardeningExcluder 'drupal/core-vendor-hardening' => '*', + 'php-http/discovery' => '*', // cSpell:enable ]; diff --git a/package_manager/tests/src/Build/TemplateProjectTestBase.php b/package_manager/tests/src/Build/TemplateProjectTestBase.php index a2f034a647ce04eb88147403a2e085ce259b2bfb..2d02fe1e06598906ce5f7171acf5a7cc922d435b 100644 --- a/package_manager/tests/src/Build/TemplateProjectTestBase.php +++ b/package_manager/tests/src/Build/TemplateProjectTestBase.php @@ -312,13 +312,14 @@ END; // Now that we know the project was created successfully, we can set the // web root with confidence. $this->webRoot = 'project/' . $this->runComposer('composer config extra.drupal-scaffold.locations.web-root', 'project'); + // BEGIN: DELETE FROM CORE MERGE REQUEST // List the info files that need to be made compatible with our fake version // of Drupal core. $info_files = [ - 'core/modules/package_manager/package_manager.info.yml', - 'core/modules/automatic_updates/automatic_updates.info.yml', + 'modules/contrib/automatic_updates/package_manager/package_manager.info.yml', + 'modules/contrib/automatic_updates/automatic_updates.info.yml', + 'modules/contrib/automatic_updates/automatic_updates_extensions/automatic_updates_extensions.info.yml', ]; - // BEGIN: DELETE FROM CORE MERGE REQUEST // Install Automatic Updates into the test project and ensure it wasn't // symlinked. $automatic_updates_dir = realpath(__DIR__ . '/../../../..'); @@ -328,13 +329,6 @@ END; $output = $this->runComposer('COMPOSER_MIRROR_PATH_REPOS=1 composer require --update-with-all-dependencies psr/http-message "drupal/automatic_updates:@dev"', $dir); $this->assertStringNotContainsString('Symlinking', $output); } - // In contrib, the info files have different paths. - $info_files = [ - 'modules/contrib/automatic_updates/package_manager/package_manager.info.yml', - 'modules/contrib/automatic_updates/automatic_updates.info.yml', - 'modules/contrib/automatic_updates/automatic_updates_extensions/automatic_updates_extensions.info.yml', - ]; - // END: DELETE FROM CORE MERGE REQUEST foreach ($info_files as $path) { $path = $this->getWebRoot() . $path; $this->assertFileIsWritable($path); @@ -343,6 +337,7 @@ END; $info['core_version_requirement'] .= ' || ^9.7'; file_put_contents($path, Yaml::encode($info)); } + // END: DELETE FROM CORE MERGE REQUEST // Install Drupal. $this->installQuickStart('standard'); @@ -434,6 +429,7 @@ END; 'reference' => $reference, ], 'autoload' => $package_info['autoload'] ?? [], + 'provide' => $package_info['provide'] ?? [], ]; // These polyfills are dependencies of some packages, but for reasons we // don't understand, they are not installed in code bases built on PHP diff --git a/package_manager/tests/src/Kernel/PackageManagerKernelTestBase.php b/package_manager/tests/src/Kernel/PackageManagerKernelTestBase.php index 31d126827f4b93482cdf40750b71d3a6d29627cb..5ac5eb443436e4d24e954de5a25231f784a38866 100644 --- a/package_manager/tests/src/Kernel/PackageManagerKernelTestBase.php +++ b/package_manager/tests/src/Kernel/PackageManagerKernelTestBase.php @@ -19,8 +19,8 @@ use Drupal\package_manager\PathLocator; use Drupal\package_manager\StatusCheckTrait; use Drupal\package_manager\Validator\DiskSpaceValidator; use Drupal\package_manager\StageBase; -use Drupal\Tests\automatic_updates\Traits\ComposerStagerTestTrait; use Drupal\Tests\package_manager\Traits\AssertPreconditionsTrait; +use Drupal\Tests\package_manager\Traits\ComposerStagerTestTrait; use Drupal\Tests\package_manager\Traits\FixtureManipulatorTrait; use Drupal\Tests\package_manager\Traits\FixtureUtilityTrait; use Drupal\Tests\package_manager\Traits\ValidationTestTrait; @@ -95,9 +95,8 @@ abstract class PackageManagerKernelTestBase extends KernelTestBase { * The Symfony filesystem class. * * @var \Symfony\Component\Filesystem\Filesystem - * @phpstan-ignore-next-line */ - private readonly Filesystem $fileSystem; + private Filesystem $fileSystem; /** * A logger that will fail the test if Package Manager logs any errors. @@ -105,9 +104,8 @@ abstract class PackageManagerKernelTestBase extends KernelTestBase { * @var \ColinODell\PsrTestLogger\TestLogger * * @see ::tearDown() - * @phpstan-ignore-next-line */ - protected readonly TestLogger $failureLogger; + protected TestLogger $failureLogger; /** * {@inheritdoc} diff --git a/package_manager/tests/src/Kernel/StageOwnershipTest.php b/package_manager/tests/src/Kernel/StageOwnershipTest.php index a8de6438c7797dc116126134c1c7083753a27203..e0f3a6a6394b716f6f40f7bcf599960255e22c11 100644 --- a/package_manager/tests/src/Kernel/StageOwnershipTest.php +++ b/package_manager/tests/src/Kernel/StageOwnershipTest.php @@ -38,8 +38,6 @@ class StageOwnershipTest extends PackageManagerKernelTestBase { */ protected function setUp(): void { parent::setUp(); - $this->installSchema('system', ['sequences']); - $this->installSchema('user', ['users_data']); $this->installEntitySchema('user'); } diff --git a/tests/src/Traits/ComposerStagerTestTrait.php b/package_manager/tests/src/Traits/ComposerStagerTestTrait.php similarity index 97% rename from tests/src/Traits/ComposerStagerTestTrait.php rename to package_manager/tests/src/Traits/ComposerStagerTestTrait.php index af5775f597162b52cb387013690353b327ba483b..cc9b6442d0864b7893dfbfa1940a5aa913d0feed 100644 --- a/tests/src/Traits/ComposerStagerTestTrait.php +++ b/package_manager/tests/src/Traits/ComposerStagerTestTrait.php @@ -2,7 +2,7 @@ declare(strict_types = 1); -namespace Drupal\Tests\automatic_updates\Traits; +namespace Drupal\Tests\package_manager\Traits; use PhpTuf\ComposerStager\API\Translation\Factory\TranslatableFactoryInterface; use PhpTuf\ComposerStager\API\Translation\Value\TranslatableInterface; diff --git a/package_manager/tests/src/Unit/PathLocatorTest.php b/package_manager/tests/src/Unit/PathLocatorTest.php index 0cafee88e0424e345058f8ece67a207d825db935..6a1ec8c9edd7011c94b54983198f2982d180eeca 100644 --- a/package_manager/tests/src/Unit/PathLocatorTest.php +++ b/package_manager/tests/src/Unit/PathLocatorTest.php @@ -108,7 +108,7 @@ class PathLocatorTest extends UnitTestCase { public function testWebRoot(string $app_root, string $project_root, string $expected_web_root): void { $path_locator = $this->getMockBuilder(PathLocator::class) // Mock all methods except getWebRoot(). - ->setMethodsExcept(['getWebRoot']) + ->onlyMethods(['getProjectRoot', 'getStagingRoot', 'getVendorDirectory']) ->setConstructorArgs([ $app_root, $this->getConfigFactoryStub(), diff --git a/scripts/src/Converter.php b/scripts/src/Converter.php index 147349cbb3d544c21fa3ca08e0d29b2d673025c8..cd6a2fd75223ede7c7811871f3ebd2bc97a2d95d 100644 --- a/scripts/src/Converter.php +++ b/scripts/src/Converter.php @@ -110,7 +110,7 @@ class Converter { new \SplFileInfo("$core_module_path/automatic_updates.info.yml"), new \SplFileInfo("$core_module_path/package_manager/package_manager.info.yml"), ], - "core_version_requirement: ^9.7 || ^10.1", + "core_version_requirement: ^10", "package: Core\nversion: VERSION\nlifecycle: experimental", ); $replacements = [ @@ -125,7 +125,7 @@ class Converter { static::removeLines($core_dir); self::info('Remove unneeded lines'); - $fs->rename("$core_module_path/package_manager", $core_dir . "/core/modules/package_manager"); + $fs->rename("$core_module_path/package_manager", $package_manager_core_path); self::info('Move package manager'); // âš ï¸ For now, we're only trying to get package_manager committed, not automatic_updates! @@ -134,6 +134,10 @@ class Converter { static::addWordsToDictionary($core_dir, self::getContribDir() . "/dictionary.txt"); self::info("Added to dictionary"); $fs->chmod($new_script_path, 0644); + chdir($core_dir); + // Run phpcbf because removing code from merge request may result in unused + // use statements or multiple empty lines. + system("composer phpcbf $package_manager_core_path"); if (self::RUN_CHECKS) { static::runCoreChecks($core_dir); self::info('Ran core checks'); @@ -391,7 +395,7 @@ class Converter { private static function runCoreChecks(string $core_dir): void { chdir($core_dir); $result = NULL; - system(' sh ./core/scripts/dev/commit-code-check.sh --branch 10.1.x', $result); + system(' sh ./core/scripts/dev/commit-code-check.sh --branch 11.x', $result); if ($result !== 0) { print "ðŸ˜commit-code-check.sh failed"; print "Reset using this command in the core checkout:"; diff --git a/tests/src/Functional/AutomaticUpdatesFunctionalTestBase.php b/tests/src/Functional/AutomaticUpdatesFunctionalTestBase.php index 70c9a88e2ab3e487f9863042f0a7fae9f7b720e1..e290bb1e67d2f3198b47541a82326301295c2b1c 100644 --- a/tests/src/Functional/AutomaticUpdatesFunctionalTestBase.php +++ b/tests/src/Functional/AutomaticUpdatesFunctionalTestBase.php @@ -9,9 +9,9 @@ use Drupal\automatic_updates\CommandExecutor; use Drupal\automatic_updates\UpdateStage; use Drupal\fixture_manipulator\StageFixtureManipulator; use Drupal\package_manager\PathLocator; -use Drupal\Tests\automatic_updates\Traits\ComposerStagerTestTrait; use Drupal\Tests\BrowserTestBase; use Drupal\Tests\package_manager\Traits\AssertPreconditionsTrait; +use Drupal\Tests\package_manager\Traits\ComposerStagerTestTrait; use Drupal\Tests\package_manager\Traits\FixtureManipulatorTrait; use Drupal\Tests\package_manager\Traits\FixtureUtilityTrait; use Symfony\Component\DependencyInjection\ContainerInterface; diff --git a/tests/src/Kernel/ConsoleUpdateStageTest.php b/tests/src/Kernel/ConsoleUpdateStageTest.php index c1ceed0439dbd9ff49162ac56cbc492d5ce312cd..9953c86b0e71446622923ee47d0be724619f3e07 100644 --- a/tests/src/Kernel/ConsoleUpdateStageTest.php +++ b/tests/src/Kernel/ConsoleUpdateStageTest.php @@ -76,7 +76,6 @@ class ConsoleUpdateStageTest extends AutomaticUpdatesKernelTestBase { ->get('automatic_updates') ->addLogger($this->logger); $this->installEntitySchema('user'); - $this->installSchema('user', ['users_data']); $this->setUpEmailRecipients(); $this->assertNoCronRun();