Skip to content
Snippets Groups Projects
Commit 0e561b48 authored by Adam G-H's avatar Adam G-H
Browse files

Issue #3256958 by phenaproxima: HEAD is broken on Drupal 9.4.x

parent da33c349
No related branches found
No related tags found
1 merge request!156Issue #3256958: HEAD is broken on Drupal 9.4.x
......@@ -238,14 +238,15 @@ class Stage {
public function require(array $constraints, bool $dev = FALSE): void {
$this->checkOwnership();
$command = array_merge(['require'], $constraints);
$command[] = '--update-with-all-dependencies';
$command = array_merge(['require', '--no-update'], $constraints);
if ($dev) {
$command[] = '--dev';
}
$this->dispatch(new PreRequireEvent($this));
$this->stager->stage($command, $this->getStageDirectory());
$dir = $this->getStageDirectory();
$this->stager->stage($command, $dir);
$this->stager->stage(['update', '--with-all-dependencies'], $dir);
$this->dispatch(new PostRequireEvent($this));
}
......
......@@ -2,7 +2,7 @@
namespace Drupal\Tests\package_manager\Functional;
use Drupal\Core\Database\Driver\sqlite\Connection;
use Drupal\Core\Database\Connection;
use Drupal\Core\Site\Settings;
use Drupal\package_manager\PathLocator;
use Drupal\package_manager\Stage;
......
......@@ -2,7 +2,7 @@
namespace Drupal\Tests\package_manager\Kernel;
use Drupal\Core\Database\Driver\sqlite\Connection;
use Drupal\Core\Database\Connection;
use Drupal\package_manager\Event\PreCreateEvent;
use Drupal\package_manager\EventSubscriber\ExcludedPathsSubscriber;
......
......@@ -45,6 +45,16 @@ abstract class TemplateProjectSiteTestBase extends QuickStartTestBase {
$this->runComposer('composer remove --no-update drupal/automatic_updates', 'composer/Metapackage/CoreRecommended');
}
/**
* {@inheritdoc}
*/
public function getCodebaseFinder() {
// If core's npm dependencies are installed, we don't want them to be
// included in the upstream version of core that gets installed into the
// test site.
return parent::getCodebaseFinder()->notPath('#^core/node_modules#');
}
/**
* Returns the full path to the test site's document root.
*
......
......@@ -36,7 +36,9 @@ abstract class UpdateTestBase extends TemplateProjectSiteTestBase {
// symlinked.
$dir = 'project';
$this->runComposer('composer config repo.automatic_updates path ' . __DIR__ . '/../../..', $dir);
$this->assertStringNotContainsString('Symlinking', $this->runComposer('COMPOSER_MIRROR_PATH_REPOS=1 composer require "drupal/automatic_updates:@dev"', $dir));
$this->runComposer('composer require --no-update "drupal/automatic_updates:@dev"', $dir);
$output = $this->runComposer('COMPOSER_MIRROR_PATH_REPOS=1 composer update --with-all-dependencies', $dir);
$this->assertStringNotContainsString('Symlinking', $output);
// Install Drupal. Always allow test modules to be installed in the UI and,
// for easier debugging, always display errors in their dubious glory.
......
......@@ -282,7 +282,10 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
/** @var \Drupal\package_manager_bypass\InvocationRecorderBase $stager */
$stager = $this->container->get('package_manager.stager');
$this->assertCount($attempted_times, $stager->getInvocationArguments());
// If an update was attempted, then there will be two calls to the stager:
// one to change the constraints in composer.json, and another to actually
// update the installed dependencies.
$this->assertCount($attempted_times * 2, $stager->getInvocationArguments());
/** @var \Drupal\package_manager_bypass\InvocationRecorderBase $committer */
$committer = $this->container->get('package_manager.committer');
......
......@@ -110,7 +110,10 @@ class CronUpdaterTest extends AutomaticUpdatesKernelTestBase {
$will_update = (int) $will_update;
$this->assertCount($will_update, $this->container->get('package_manager.beginner')->getInvocationArguments());
$this->assertCount($will_update, $this->container->get('package_manager.stager')->getInvocationArguments());
// If updates happen, then there will be two calls to the stager: one to
// change the constraints in composer.json, and another to actually update
// the installed dependencies.
$this->assertCount($will_update * 2, $this->container->get('package_manager.stager')->getInvocationArguments());
$this->assertCount($will_update, $this->container->get('package_manager.committer')->getInvocationArguments());
}
......
......@@ -75,26 +75,29 @@ class UpdaterTest extends AutomaticUpdatesKernelTestBase {
// The production dependencies should be updated first...
$expected_require_arguments = [
'require',
'--no-update',
'drupal/core-recommended:9.8.1',
'--update-with-all-dependencies',
];
// ...followed by the dev dependencies.
$expected_require_dev_arguments = [
'require',
'--no-update',
'drupal/core-dev:9.8.1',
'--update-with-all-dependencies',
'--dev',
];
// In both cases, `composer update` will be called separately.
$expected_update_arguments = ['update', '--with-all-dependencies'];
$this->container->get('automatic_updates.updater')->claim($id)->stage();
/** @var \Drupal\package_manager_bypass\InvocationRecorderBase $stager */
$stager = $this->container->get('package_manager.stager');
[
$actual_require_arguments,
$actual_require_dev_arguments,
] = $stager->getInvocationArguments();
$this->assertSame($expected_require_arguments, $actual_require_arguments[0]);
$this->assertSame($expected_require_dev_arguments, $actual_require_dev_arguments[0]);
$invocation_arguments = $stager->getInvocationArguments();
$this->assertCount(4, $invocation_arguments);
$this->assertSame($expected_require_arguments, $invocation_arguments[0][0]);
$this->assertSame($expected_update_arguments, $invocation_arguments[1][0]);
$this->assertSame($expected_require_dev_arguments, $invocation_arguments[2][0]);
$this->assertSame($expected_update_arguments, $invocation_arguments[3][0]);
}
/**
......
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