Skip to content
Snippets Groups Projects
Commit a81c7a5a authored by Ted Bowman's avatar Ted Bowman
Browse files

Issue #3386135: Update module's merge request process for current core HEAD

parent a82cf8c8
No related branches found
No related tags found
No related merge requests found
......@@ -11,3 +11,4 @@ filedate
unshallow
hhvm
proc_open
bootable
......@@ -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
];
......
......@@ -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
......
......@@ -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}
......
......@@ -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');
}
......
......@@ -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;
......
......@@ -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(),
......
......@@ -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:";
......
......@@ -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;
......
......@@ -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();
......
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