Skip to content
Snippets Groups Projects
Commit a90285a7 authored by Kunal Sachdev's avatar Kunal Sachdev Committed by Adam G-H
Browse files

Issue #3326486 by kunal.sachdev, phenaproxima, Wim Leers, tedbow, yash.rode:...

Issue #3326486 by kunal.sachdev, phenaproxima, Wim Leers, tedbow, yash.rode: Rename Stage to StageBase to clarify its relationship to its subclasses, and add "Stage" suffix to the Updater classes
parent fa75661e
No related branches found
No related tags found
No related merge requests found
Showing
with 99 additions and 99 deletions
......@@ -7,7 +7,7 @@
declare(strict_types = 1);
use Drupal\automatic_updates\CronUpdater;
use Drupal\automatic_updates\CronUpdateStage;
use Drupal\automatic_updates\Validation\StatusCheckRequirements;
use Drupal\system\SystemManager;
......@@ -15,7 +15,7 @@ use Drupal\system\SystemManager;
* Implements hook_uninstall().
*/
function automatic_updates_uninstall() {
\Drupal::service('automatic_updates.updater')->destroy(TRUE);
\Drupal::service('automatic_updates.update_stage')->destroy(TRUE);
}
/**
......@@ -30,7 +30,7 @@ function automatic_updates_requirements($phase) {
// Check that site has cron updates enabled or not.
// @todo Remove in https://www.drupal.org/project/automatic_updates/issues/3284443
if (\Drupal::configFactory()->get('automatic_updates.settings')->get('cron') !== CronUpdater::DISABLED) {
if (\Drupal::configFactory()->get('automatic_updates.settings')->get('cron') !== CronUpdateStage::DISABLED) {
$requirements['automatic_updates_cron'] = [
'title' => t('Cron installs updates automatically'),
'severity' => SystemManager::REQUIREMENT_WARNING,
......
......@@ -8,7 +8,7 @@
declare(strict_types = 1);
use Drupal\automatic_updates\BatchProcessor;
use Drupal\automatic_updates\CronUpdater;
use Drupal\automatic_updates\CronUpdateStage;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\automatic_updates\Validation\AdminStatusCheckMessages;
use Drupal\Core\Url;
......@@ -169,9 +169,9 @@ function automatic_updates_cron() {
return;
}
/** @var \Drupal\automatic_updates\CronUpdater $updater */
$updater = \Drupal::service('automatic_updates.cron_updater');
$updater->handleCron();
/** @var \Drupal\automatic_updates\CronUpdateStage $stage */
$stage = \Drupal::service('automatic_updates.cron_update_stage');
$stage->handleCron();
/** @var \Drupal\automatic_updates\Validation\StatusChecker $status_checker */
$status_checker = \Drupal::service('automatic_updates.status_checker');
......@@ -184,7 +184,7 @@ function automatic_updates_cron() {
}
// Only try to send failure notifications if unattended updates are enabled.
if ($updater->getMode() !== CronUpdater::DISABLED) {
if ($stage->getMode() !== CronUpdateStage::DISABLED) {
\Drupal::service('automatic_updates.status_check_mailer')
->sendFailureNotifications($last_results, $status_checker->getResults());
}
......@@ -199,12 +199,12 @@ function automatic_updates_modules_installed($modules) {
/** @var \Drupal\automatic_updates\Validation\StatusChecker $status_checker */
$status_checker = \Drupal::service('automatic_updates.status_checker');
$status_checker->run();
/** @var \Drupal\automatic_updates\CronUpdater $cron_updater */
$cron_updater = \Drupal::service('automatic_updates.cron_updater');
/** @var \Drupal\automatic_updates\CronUpdateStage $stage */
$stage = \Drupal::service('automatic_updates.cron_update_stage');
// If cron updates are disabled status check messages will not be displayed on
// admin pages. Therefore, after installing the module the user will not be
// alerted to any problems until they access the status report page.
if ($cron_updater->getMode() === CronUpdater::DISABLED) {
if ($stage->getMode() === CronUpdateStage::DISABLED) {
/** @var \Drupal\automatic_updates\Validation\AdminStatusCheckMessages $status_check_messages */
$status_check_messages = \Drupal::classResolver(AdminStatusCheckMessages::class);
$status_check_messages->displayResultSummary();
......@@ -243,15 +243,15 @@ function automatic_updates_preprocess_update_project_status(array &$variables) {
if ($project['name'] !== 'drupal') {
return;
}
$updater = \Drupal::service('automatic_updates.updater');
$stage = \Drupal::service('automatic_updates.update_stage');
$supported_target_versions = [];
/** @var \Drupal\automatic_updates\ReleaseChooser $recommender */
$recommender = \Drupal::service('automatic_updates.release_chooser');
try {
if ($installed_minor_release = $recommender->getLatestInInstalledMinor($updater)) {
if ($installed_minor_release = $recommender->getLatestInInstalledMinor($stage)) {
$supported_target_versions[] = $installed_minor_release->getVersion();
}
if ($next_minor_release = $recommender->getLatestInNextMinor($updater)) {
if ($next_minor_release = $recommender->getLatestInNextMinor($stage)) {
$supported_target_versions[] = $next_minor_release->getVersion();
}
}
......
......@@ -30,6 +30,6 @@ automatic_updates.finish:
automatic_updates.cron.post_apply:
path: '/automatic-update/cron/post-apply/{stage_id}/{installed_version}/{target_version}/{key}'
defaults:
_controller: 'automatic_updates.cron_updater:handlePostApply'
_controller: 'automatic_updates.cron_update_stage:handlePostApply'
requirements:
_access_system_cron: 'TRUE'
......@@ -18,16 +18,16 @@ services:
automatic_updates.status_check_mailer:
class: Drupal\automatic_updates\StatusCheckMailer
Drupal\automatic_updates\StatusCheckMailer: '@automatic_updates.status_check_mailer'
automatic_updates.updater:
class: Drupal\automatic_updates\Updater
automatic_updates.update_stage:
class: Drupal\automatic_updates\UpdateStage
calls:
- ['setLogger', ['@logger.channel.automatic_updates']]
Drupal\automatic_updates\Updater: '@automatic_updates.updater'
automatic_updates.cron_updater:
class: Drupal\automatic_updates\CronUpdater
Drupal\automatic_updates\UpdateStage: '@automatic_updates.update_stage'
automatic_updates.cron_update_stage:
class: Drupal\automatic_updates\CronUpdateStage
calls:
- ['setLogger', ['@logger.channel.automatic_updates']]
Drupal\automatic_updates\CronUpdater: '@automatic_updates.cron_updater'
Drupal\automatic_updates\CronUpdateStage: '@automatic_updates.cron_update_stage'
automatic_updates.requested_update_validator:
class: Drupal\automatic_updates\Validator\RequestedUpdateValidator
tags:
......
......@@ -2,9 +2,9 @@ services:
_defaults:
autowire: true
automatic_updates_extensions.updater:
class: Drupal\automatic_updates_extensions\ExtensionUpdater
Drupal\automatic_updates_extensions\ExtensionUpdater: '@automatic_updates_extensions.updater'
automatic_updates_extensions.update_stage:
class: Drupal\automatic_updates_extensions\ExtensionUpdateStage
Drupal\automatic_updates_extensions\ExtensionUpdateStage: '@automatic_updates_extensions.update_stage'
automatic_updates_extensions.validator.target_release:
class: Drupal\automatic_updates_extensions\Validator\UpdateReleaseValidator
tags:
......
......@@ -24,13 +24,13 @@ final class BatchProcessor {
public const STAGE_ID_SESSION_KEY = '_automatic_updates_extensions_stage_id';
/**
* Gets the updater service.
* Gets the update stage service.
*
* @return \Drupal\automatic_updates_extensions\ExtensionUpdater
* The updater service.
* @return \Drupal\automatic_updates_extensions\ExtensionUpdateStage
* The update stage service.
*/
protected static function getUpdater(): ExtensionUpdater {
return \Drupal::service('automatic_updates_extensions.updater');
protected static function getStage(): ExtensionUpdateStage {
return \Drupal::service('automatic_updates_extensions.update_stage');
}
/**
......@@ -51,18 +51,18 @@ final class BatchProcessor {
}
/**
* Calls the updater's begin() method.
* Calls the update stage's begin() method.
*
* @param string[] $project_versions
* The project versions to be staged in the update, keyed by package name.
* @param array $context
* The current context of the batch job.
*
* @see \Drupal\automatic_updates_extensions\ExtensionUpdater::begin()
* @see \Drupal\automatic_updates_extensions\ExtensionUpdateStage::begin()
*/
public static function begin(array $project_versions, array &$context): void {
try {
$stage_id = static::getUpdater()->begin($project_versions);
$stage_id = static::getStage()->begin($project_versions);
\Drupal::service('session')->set(static::STAGE_ID_SESSION_KEY, $stage_id);
}
catch (\Throwable $e) {
......@@ -71,17 +71,17 @@ final class BatchProcessor {
}
/**
* Calls the updater's stageVersions() method.
* Calls the update stage's stage() method.
*
* @param array $context
* The current context of the batch job.
*
* @see \Drupal\automatic_updates\Updater::stage()
* @see \Drupal\automatic_updates\UpdateStage::stage()
*/
public static function stage(array &$context): void {
$stage_id = \Drupal::service('session')->get(static::STAGE_ID_SESSION_KEY);
try {
static::getUpdater()->claim($stage_id)->stage();
static::getStage()->claim($stage_id)->stage();
}
catch (\Throwable $e) {
static::clean($stage_id, $context);
......@@ -90,18 +90,18 @@ final class BatchProcessor {
}
/**
* Calls the updater's commit() method.
* Calls the update stage's apply() method.
*
* @param string $stage_id
* The stage ID.
* @param array $context
* The current context of the batch job.
*
* @see \Drupal\automatic_updates\Updater::apply()
* @see \Drupal\automatic_updates_extensions\ExtensionUpdateStage::apply()
*/
public static function commit(string $stage_id, array &$context): void {
try {
static::getUpdater()->claim($stage_id)->apply();
static::getStage()->claim($stage_id)->apply();
// The batch system does not allow any single request to run for longer
// than a second, so this will force the next operation to be done in a
// new request. This helps keep the running code in as consistent a state
......@@ -118,18 +118,18 @@ final class BatchProcessor {
}
/**
* Calls the updater's postApply() method.
* Calls the update stage's postApply() method.
*
* @param string $stage_id
* The stage ID.
* @param array $context
* The current context of the batch job.
*
* @see \Drupal\automatic_updates\Updater::postApply()
* @see \Drupal\automatic_updates\UpdateStage::postApply()
*/
public static function postApply(string $stage_id, array &$context): void {
try {
static::getUpdater()->claim($stage_id)->postApply();
static::getStage()->claim($stage_id)->postApply();
}
catch (\Throwable $e) {
static::handleException($e, $context);
......@@ -137,18 +137,18 @@ final class BatchProcessor {
}
/**
* Calls the updater's clean() method.
* Calls the update stage's destroy() method.
*
* @param string $stage_id
* The stage ID.
* @param array $context
* The current context of the batch job.
*
* @see \Drupal\automatic_updates\Updater::clean()
* @see \Drupal\automatic_updates_extensions\ExtensionUpdateStage::destroy()
*/
public static function clean(string $stage_id, array &$context): void {
try {
static::getUpdater()->claim($stage_id)->destroy();
static::getStage()->claim($stage_id)->destroy();
}
catch (\Throwable $e) {
static::handleException($e, $context);
......
......@@ -12,7 +12,7 @@ use Drupal\package_manager\ComposerInspector;
use Drupal\package_manager\FailureMarker;
use Drupal\package_manager\LegacyVersionUtility;
use Drupal\package_manager\PathLocator;
use Drupal\package_manager\Stage;
use Drupal\package_manager\StageBase;
use PhpTuf\ComposerStager\Domain\Core\Beginner\BeginnerInterface;
use PhpTuf\ComposerStager\Domain\Core\Committer\CommitterInterface;
use PhpTuf\ComposerStager\Domain\Core\Stager\StagerInterface;
......@@ -26,10 +26,10 @@ use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
* This class is an internal part of the module's update handling and
* should not be used by external code.
*/
class ExtensionUpdater extends Stage {
class ExtensionUpdateStage extends StageBase {
/**
* Constructs a new ExtensionUpdater object.
* Constructs a new ExtensionUpdateStage object.
*
* @param \Drupal\package_manager\ComposerInspector $composerInspector
* The Composer inspector service.
......
......@@ -12,7 +12,7 @@ use Drupal\package_manager\ProjectInfo;
use Drupal\package_manager\ValidationResult;
use Drupal\automatic_updates_extensions\BatchProcessor;
use Drupal\automatic_updates\BatchProcessor as AutoUpdatesBatchProcessor;
use Drupal\automatic_updates_extensions\ExtensionUpdater;
use Drupal\automatic_updates_extensions\ExtensionUpdateStage;
use Drupal\Core\Batch\BatchBuilder;
use Drupal\Core\Extension\ModuleExtensionList;
use Drupal\Core\Form\FormStateInterface;
......@@ -37,8 +37,8 @@ final class UpdateReady extends UpdateFormBase {
/**
* Constructs a new UpdateReady object.
*
* @param \Drupal\automatic_updates_extensions\ExtensionUpdater $updater
* The updater service.
* @param \Drupal\automatic_updates_extensions\ExtensionUpdateStage $stage
* The update stage service.
* @param \Drupal\Core\Messenger\MessengerInterface $messenger
* The messenger service.
* @param \Drupal\Core\State\StateInterface $state
......@@ -55,7 +55,7 @@ final class UpdateReady extends UpdateFormBase {
* The path locator service.
*/
public function __construct(
private ExtensionUpdater $updater,
private ExtensionUpdateStage $stage,
MessengerInterface $messenger,
private StateInterface $state,
private ModuleExtensionList $moduleList,
......@@ -79,7 +79,7 @@ final class UpdateReady extends UpdateFormBase {
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('automatic_updates_extensions.updater'),
$container->get('automatic_updates_extensions.update_stage'),
$container->get('messenger'),
$container->get('state'),
$container->get('extension.list.module'),
......@@ -95,7 +95,7 @@ final class UpdateReady extends UpdateFormBase {
*/
public function buildForm(array $form, FormStateInterface $form_state, string $stage_id = NULL) {
try {
$this->updater->claim($stage_id);
$this->stage->claim($stage_id);
}
catch (StageOwnershipException) {
$this->messenger()->addError($this->t('Cannot continue the update because another Composer operation is currently in progress.'));
......@@ -144,7 +144,7 @@ final class UpdateReady extends UpdateFormBase {
// Don't run the status checks once the form has been submitted.
if (!$form_state->getUserInput()) {
$results = $this->runStatusCheck($this->updater, $this->eventDispatcher);
$results = $this->runStatusCheck($this->stage, $this->eventDispatcher);
// This will have no effect if $results is empty.
$this->displayResults($results, $this->renderer);
// If any errors occurred, return the form early so the user cannot
......@@ -191,7 +191,7 @@ final class UpdateReady extends UpdateFormBase {
*/
public function cancel(array &$form, FormStateInterface $form_state): void {
try {
$this->updater->destroy();
$this->stage->destroy();
$this->messenger()->addStatus($this->t('The update was successfully cancelled.'));
$form_state->setRedirect('automatic_updates_extensions.report_update');
}
......@@ -209,12 +209,12 @@ final class UpdateReady extends UpdateFormBase {
private function showUpdates(): array {
// Get packages that were updated in the stage directory.
$installed_packages = $this->composerInspector->getInstalledPackagesList($this->pathLocator->getProjectRoot());
$staged_packages = $this->composerInspector->getInstalledPackagesList($this->updater->getStageDirectory());
$staged_packages = $this->composerInspector->getInstalledPackagesList($this->stage->getStageDirectory());
$updated_packages = $staged_packages->getPackagesWithDifferentVersionsIn($installed_packages);
// Build a list of package names that were updated by user request.
$updated_by_request = [];
foreach ($this->updater->getPackageVersions() as $group) {
foreach ($this->stage->getPackageVersions() as $group) {
$updated_by_request = array_merge($updated_by_request, array_keys($group));
}
......
......@@ -6,7 +6,7 @@ namespace Drupal\automatic_updates_extensions\Form;
use Drupal\automatic_updates\Form\UpdateFormBase;
use Drupal\automatic_updates_extensions\BatchProcessor;
use Drupal\automatic_updates_extensions\ExtensionUpdater;
use Drupal\automatic_updates_extensions\ExtensionUpdateStage;
use Drupal\Core\Batch\BatchBuilder;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\State\StateInterface;
......@@ -37,7 +37,7 @@ final class UpdaterForm extends UpdateFormBase {
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('automatic_updates_extensions.updater'),
$container->get('automatic_updates_extensions.update_stage'),
$container->get('event_dispatcher'),
$container->get('renderer'),
$container->get('state'),
......@@ -50,8 +50,8 @@ final class UpdaterForm extends UpdateFormBase {
/**
* Constructs a new UpdaterForm object.
*
* @param \Drupal\automatic_updates_extensions\ExtensionUpdater $extensionUpdater
* The extension updater service.
* @param \Drupal\automatic_updates_extensions\ExtensionUpdateStage $stage
* The extension update stage service.
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher
* The extension event dispatcher service.
* @param \Drupal\Core\Render\RendererInterface $renderer
......@@ -66,7 +66,7 @@ final class UpdaterForm extends UpdateFormBase {
* The path locator service.
*/
public function __construct(
private ExtensionUpdater $extensionUpdater,
private ExtensionUpdateStage $stage,
private EventDispatcherInterface $eventDispatcher,
private RendererInterface $renderer,
private StateInterface $state,
......@@ -139,7 +139,7 @@ final class UpdaterForm extends UpdateFormBase {
$results = [];
}
else {
$results = $this->runStatusCheck($this->extensionUpdater, $this->eventDispatcher);
$results = $this->runStatusCheck($this->stage, $this->eventDispatcher);
}
$this->displayResults($results, $this->renderer);
$security_level = ValidationResult::getOverallSeverity($results);
......@@ -166,7 +166,7 @@ final class UpdaterForm extends UpdateFormBase {
*/
protected function actions(FormStateInterface $form_state): array {
$actions = ['#type' => 'actions'];
if (!$this->extensionUpdater->isAvailable()) {
if (!$this->stage->isAvailable()) {
// If the form has been submitted do not display this error message
// because ::deleteExistingUpdate() may run on submit. The message will
// still be displayed on form build if needed.
......@@ -192,7 +192,7 @@ final class UpdaterForm extends UpdateFormBase {
* Submit function to delete an existing in-progress update.
*/
public function deleteExistingUpdate(): void {
$this->extensionUpdater->destroy(TRUE);
$this->stage->destroy(TRUE);
$this->messenger()->addMessage($this->t("Staged update deleted"));
}
......
......@@ -7,7 +7,7 @@ namespace Drupal\automatic_updates_extensions\Validator;
use Drupal\package_manager\ComposerInspector;
use Drupal\package_manager\PathLocator;
use Drupal\package_manager\ProjectInfo;
use Drupal\automatic_updates_extensions\ExtensionUpdater;
use Drupal\automatic_updates_extensions\ExtensionUpdateStage;
use Drupal\package_manager\LegacyVersionUtility;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\package_manager\Event\PreCreateEvent;
......@@ -89,7 +89,7 @@ final class UpdateReleaseValidator implements EventSubscriberInterface {
public function checkRelease(PreCreateEvent $event): void {
$stage = $event->stage;
// This check only works with Automatic Updates Extensions.
if (!$stage instanceof ExtensionUpdater) {
if (!$stage instanceof ExtensionUpdateStage) {
return;
}
......
......@@ -23,7 +23,7 @@ class ApiController extends PackageManagerApiController {
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('automatic_updates_extensions.updater'),
$container->get('automatic_updates_extensions.update_stage'),
$container->get('package_manager.path_locator')
);
}
......
......@@ -81,14 +81,14 @@ abstract class AutomaticUpdatesExtensionsKernelTestBase extends AutomaticUpdates
* be passed if $expected_results is not empty.
*/
protected function assertUpdateResults(array $project_versions, array $expected_results, string $event_class = NULL): void {
$updater = $this->container->get('automatic_updates_extensions.updater');
$stage = $this->container->get('automatic_updates_extensions.update_stage');
try {
$updater->begin($project_versions);
$updater->stage();
$updater->apply();
$updater->postApply();
$updater->destroy();
$stage->begin($project_versions);
$stage->stage();
$stage->apply();
$stage->postApply();
$stage->destroy();
// If we did not get an exception, ensure we didn't expect any results.
$this->assertEmpty($expected_results);
......
......@@ -4,15 +4,15 @@ declare(strict_types = 1);
namespace Drupal\Tests\automatic_updates_extensions\Kernel;
use Drupal\automatic_updates_extensions\ExtensionUpdater;
use Drupal\automatic_updates_extensions\ExtensionUpdateStage;
use Drupal\Tests\user\Traits\UserCreationTrait;
/**
* @coversDefaultClass \Drupal\automatic_updates_extensions\ExtensionUpdater
* @coversDefaultClass \Drupal\automatic_updates_extensions\ExtensionUpdateStage
* @group automatic_updates_extensions
* @internal
*/
class ExtensionUpdaterTest extends AutomaticUpdatesExtensionsKernelTestBase {
class ExtensionUpdateStageTest extends AutomaticUpdatesExtensionsKernelTestBase {
use UserCreationTrait;
......@@ -46,7 +46,7 @@ class ExtensionUpdaterTest extends AutomaticUpdatesExtensionsKernelTestBase {
* Tests that correct versions are staged after calling ::begin().
*/
public function testCorrectVersionsStaged(): void {
$id = $this->container->get(ExtensionUpdater::class)->begin([
$id = $this->container->get(ExtensionUpdateStage::class)->begin([
'my_module' => '9.8.1',
// Use a legacy version number to ensure they are converted to semantic
// version numbers which will work with the drupal.org Composer facade.
......@@ -61,7 +61,7 @@ class ExtensionUpdaterTest extends AutomaticUpdatesExtensionsKernelTestBase {
// Keep using the user account we created.
$this->setCurrentUser($user);
$extension_updater = $this->container->get(ExtensionUpdater::class);
$stage = $this->container->get(ExtensionUpdateStage::class);
// Ensure that the target package versions are what we expect.
$expected_versions = [
......@@ -72,9 +72,9 @@ class ExtensionUpdaterTest extends AutomaticUpdatesExtensionsKernelTestBase {
'drupal/my_dev_module' => '1.2.0-alpha1@alpha',
],
];
$this->assertSame($expected_versions, $extension_updater->claim($id)->getPackageVersions());
$this->assertSame($expected_versions, $stage->claim($id)->getPackageVersions());
// When we call ExtensionUpdater::stage(), the stored project versions
// When we call ExtensionUpdateStage::stage(), the stored project versions
// should be read from state and passed to Composer Stager's Stager service,
// in the form of a Composer command. This is done using
// package_manager_bypass's invocation recorder, rather than a regular mock,
......@@ -102,7 +102,7 @@ class ExtensionUpdaterTest extends AutomaticUpdatesExtensionsKernelTestBase {
'drupal/my_dev_module:1.2.0-alpha1@alpha',
],
];
$extension_updater->stage();
$stage->stage();
$actual_arguments = $this->container->get('package_manager.stager')
->getInvocationArguments();
......@@ -120,7 +120,7 @@ class ExtensionUpdaterTest extends AutomaticUpdatesExtensionsKernelTestBase {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage("The project contrib_profile1 cannot be updated because updating install profiles is not supported.");
$this->container->get(ExtensionUpdater::class)
$this->container->get(ExtensionUpdateStage::class)
->begin([
'contrib_profile1' => '1.1.0',
]);
......@@ -132,7 +132,7 @@ class ExtensionUpdaterTest extends AutomaticUpdatesExtensionsKernelTestBase {
public function testNoProjectsInBegin(): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('No projects to begin the update');
$this->container->get(ExtensionUpdater::class)->begin([]);
$this->container->get(ExtensionUpdateStage::class)->begin([]);
}
/**
......@@ -141,7 +141,7 @@ class ExtensionUpdaterTest extends AutomaticUpdatesExtensionsKernelTestBase {
public function testUnknownDrupalProject(): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage("The project my_module_unknown is not a Drupal project known to Composer and cannot be updated.");
$this->container->get(ExtensionUpdater::class)->begin([
$this->container->get(ExtensionUpdateStage::class)->begin([
'my_module_unknown' => '9.8.1',
]);
}
......
updater's
stage's
stager's
syncer
syncers
......
......@@ -4,7 +4,7 @@ declare(strict_types = 1);
namespace Drupal\package_manager\Event;
use Drupal\package_manager\Stage;
use Drupal\package_manager\StageBase;
use PhpTuf\ComposerStager\Domain\Value\PathList\PathListInterface;
use PhpTuf\ComposerStager\Infrastructure\Value\PathList\PathList;
......@@ -26,7 +26,7 @@ class CollectIgnoredPathsEvent extends StageEvent implements PathListInterface {
/**
* {@inheritdoc}
*/
public function __construct(Stage $stage) {
public function __construct(StageBase $stage) {
parent::__construct($stage);
$this->pathList = new PathList([]);
}
......
......@@ -10,7 +10,7 @@ namespace Drupal\package_manager\Event;
* If the stage is being force destroyed, $this->stage may be an object of a
* different class than the one that originally created the stage directory.
*
* @see \Drupal\package_manager\Stage::destroy()
* @see \Drupal\package_manager\StageBase::destroy()
*/
class PostDestroyEvent extends StageEvent {
}
......@@ -4,7 +4,7 @@ declare(strict_types = 1);
namespace Drupal\package_manager\Event;
use Drupal\package_manager\Stage;
use Drupal\package_manager\StageBase;
/**
* Event fired before staged changes are synced to the active directory.
......@@ -16,7 +16,7 @@ class PreApplyEvent extends PreOperationStageEvent {
/**
* Constructs a PreApplyEvent object.
*
* @param \Drupal\package_manager\Stage $stage
* @param \Drupal\package_manager\StageBase $stage
* The stage which fired this event.
* @param string[] $ignored_paths
* The list of ignored paths. These will not be copied from the stage
......@@ -24,7 +24,7 @@ class PreApplyEvent extends PreOperationStageEvent {
* directory if they exist, when the stage directory is copied back into
* the active directory.
*/
public function __construct(Stage $stage, array $ignored_paths) {
public function __construct(StageBase $stage, array $ignored_paths) {
parent::__construct($stage);
$this->excludedPaths = $ignored_paths;
}
......
......@@ -4,7 +4,7 @@ declare(strict_types = 1);
namespace Drupal\package_manager\Event;
use Drupal\package_manager\Stage;
use Drupal\package_manager\StageBase;
/**
* Event fired before a stage directory is created.
......@@ -16,13 +16,13 @@ class PreCreateEvent extends PreOperationStageEvent {
/**
* Constructs a PreCreateEvent object.
*
* @param \Drupal\package_manager\Stage $stage
* @param \Drupal\package_manager\StageBase $stage
* The stage which fired this event.
* @param string[] $ignored_paths
* The list of ignored paths. These will not be copied into the stage
* directory when it is created.
*/
public function __construct(Stage $stage, array $ignored_paths) {
public function __construct(StageBase $stage, array $ignored_paths) {
parent::__construct($stage);
$this->excludedPaths = $ignored_paths;
}
......
......@@ -10,7 +10,7 @@ namespace Drupal\package_manager\Event;
* If the stage is being force destroyed, $this->stage may be an object of a
* different class than the one that originally created the stage directory.
*
* @see \Drupal\package_manager\Stage::destroy()
* @see \Drupal\package_manager\StageBase::destroy()
*/
class PreDestroyEvent extends PreOperationStageEvent {
}
......@@ -4,7 +4,7 @@ declare(strict_types = 1);
namespace Drupal\package_manager\Event;
use Drupal\package_manager\Stage;
use Drupal\package_manager\StageBase;
/**
* Common methods for pre- and post-require events.
......@@ -33,7 +33,7 @@ trait RequireEventTrait {
/**
* Constructs the object.
*
* @param \Drupal\package_manager\Stage $stage
* @param \Drupal\package_manager\StageBase $stage
* The stage.
* @param string[] $runtime_packages
* The runtime (i.e., non-dev) packages to be required, in the form
......@@ -41,7 +41,7 @@ trait RequireEventTrait {
* @param string[] $dev_packages
* The dev packages to be required, in the form 'vendor/name:constraint'.
*/
public function __construct(Stage $stage, array $runtime_packages, array $dev_packages = []) {
public function __construct(StageBase $stage, array $runtime_packages, array $dev_packages = []) {
$this->runtimePackages = $runtime_packages;
$this->devPackages = $dev_packages;
parent::__construct($stage);
......
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