diff --git a/automatic_updates.module b/automatic_updates.module index 79baecbeca35ef5c3ce085975e4206bd692b9daf..eaff9442737b6b0fe7851e44a0a8d29296e6c747 100644 --- a/automatic_updates.module +++ b/automatic_updates.module @@ -8,7 +8,6 @@ use Drupal\automatic_updates\BatchProcessor; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\automatic_updates\Validation\AdminReadinessMessages; -use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Url; use Drupal\system\Controller\DbUpdateController; @@ -23,7 +22,7 @@ function automatic_updates_help($route_name, RouteMatchInterface $route_match) { $output .= '<p>'; $output .= t('Automatic Updates will keep Drupal secure and up-to-date by automatically installing new patch-level updates, if available, when cron runs. It also provides a user interface to check if any updates are available and install them. You can <a href=":configure-form">configure Automatic Updates</a> to install all patch-level updates, only security updates, or no updates at all, during cron. By default, only security updates are installed during cron; this requires that you <a href=":update-form">install non-security updates through the user interface</a>.', [ ':configure-form' => Url::fromRoute('update.settings')->toString(), - ':update-form' => Url::fromRoute('automatic_updates.report_update')->toString(), + ':update-form' => Url::fromRoute('update.report_update')->toString(), ]); $output .= '</p>'; $output .= '<p>' . t('Additionally, Automatic Updates periodically runs checks to ensure that updates can be installed, and will warn site administrators if problems are detected.') . '</p>'; @@ -156,51 +155,6 @@ function automatic_updates_modules_uninstalled() { $checker_manager->run(); } -/** - * Implements hook_form_FORM_ID_alter() for 'update_manager_update_form'. - */ -function automatic_updates_form_update_manager_update_form_alter(&$form, FormStateInterface $form_state, $form_id) { - // Remove current message that core updates are not supported with a link to - // use this module's form. The local task to 'update_manager_update_form' is - // replaced by our own from but this original form would still accessible via - // by its original URL. - if (isset($form['manual_updates']['#rows']['drupal']['data']['title'])) { - $current_route = \Drupal::routeMatch()->getRouteName(); - if ($current_route === 'update.module_update') { - $redirect_route = 'automatic_updates.module_update'; - } - elseif ($current_route === 'update.report_update') { - $redirect_route = 'automatic_updates.report_update'; - } - if (!empty($redirect_route)) { - $core_updates_message = t( - '<h2>Core updates required</h2>Drupal core updates are supported by the enabled <a href="@url">Automatic Updates module</a>', - ['@url' => Url::fromRoute($redirect_route)->toString()] - ); - $form['manual_updates']['#prefix'] = $core_updates_message; - } - } -} - -/** - * Implements hook_local_tasks_alter(). - */ -function automatic_updates_local_tasks_alter(array &$local_tasks) { - // The Update module's update form only allows updating modules and themes - // via archive files, which could produce unexpected results on a site using - // our Composer-based updater. - $new_routes = [ - 'update.report_update' => 'automatic_updates.report_update', - 'update.module_update' => 'automatic_updates.module_update', - 'update.theme_update' => 'automatic_updates.theme_update', - ]; - foreach ($new_routes as $local_task_id => $new_route) { - if (!empty($local_tasks[$local_task_id])) { - $local_tasks[$local_task_id]['route_name'] = $new_route; - } - } -} - /** * Implements hook_batch_alter(). * @@ -248,7 +202,7 @@ function automatic_updates_preprocess_update_project_status(array &$variables) { '#markup' => t( '@label <a href=":update-form">Update now</a>', [ '@label' => $status['label'], - ':update-form' => Url::fromRoute('automatic_updates.report_update')->toString(), + ':update-form' => Url::fromRoute('update.report_update')->toString(), ]), ]; } @@ -259,7 +213,7 @@ function automatic_updates_preprocess_update_project_status(array &$variables) { foreach ($variables['versions'] as &$themed_version) { $version_info = &$themed_version['#version']; if ($supported_target_versions && in_array($version_info['version'], $supported_target_versions, TRUE)) { - $version_info['download_link'] = Url::fromRoute('automatic_updates.report_update')->setAbsolute()->toString(); + $version_info['download_link'] = Url::fromRoute('update.report_update')->setAbsolute()->toString(); } else { // If this version will not be displayed as an option on this module's diff --git a/automatic_updates.routing.yml b/automatic_updates.routing.yml index dd408c180958d6dae984fd4308111062b9804143..51239292efb9e8938e148ff93acf742d6f789ecb 100644 --- a/automatic_updates.routing.yml +++ b/automatic_updates.routing.yml @@ -33,38 +33,26 @@ automatic_updates.cron.post_apply: _controller: 'automatic_updates.cron_updater:handlePostApply' requirements: _access_system_cron: 'TRUE' -# Links to our updater form appear in three different sets of local tasks. To ensure the breadcrumbs and paths are -# consistent with the other local tasks in each set, we need two separate routes to the same form. + +# These routes are deprecated and will be removed in the next major version of +# Automatic Updates. They redirect to existing routes from the core Update +# module, which are overridden by Automatic Updates. +# @see \Drupal\automatic_updates\Routing\RouteSubscriber::alterRoutes() automatic_updates.report_update: path: '/admin/reports/updates/automatic-update' defaults: - _form: '\Drupal\automatic_updates\Form\UpdaterForm' - _title: 'Update' + _controller: '\Drupal\automatic_updates\Controller\UpdateController::redirectDeprecatedRoute' requirements: - _permission: 'administer software updates' - options: - _admin_route: TRUE - _maintenance_access: TRUE - _automatic_updates_readiness_messages: skip + _access: 'TRUE' automatic_updates.module_update: path: '/admin/modules/automatic-update' defaults: - _form: '\Drupal\automatic_updates\Form\UpdaterForm' - _title: 'Update' + _controller: '\Drupal\automatic_updates\Controller\UpdateController::redirectDeprecatedRoute' requirements: - _permission: 'administer software updates' - options: - _admin_route: TRUE - _maintenance_access: TRUE - _automatic_updates_readiness_messages: skip + _access: 'TRUE' automatic_updates.theme_update: path: '/admin/theme/automatic-update' defaults: - _form: '\Drupal\automatic_updates\Form\UpdaterForm' - _title: 'Update' + _controller: '\Drupal\automatic_updates\Controller\UpdateController::redirectDeprecatedRoute' requirements: - _permission: 'administer software updates' - options: - _admin_route: TRUE - _maintenance_access: TRUE - _automatic_updates_readiness_messages: skip + _access: 'TRUE' diff --git a/src/Controller/UpdateController.php b/src/Controller/UpdateController.php index ae881ffddffea2771030d06c8fb0d62e828b9728..dddbf90695c8a21981c3c3cc058e430899fb5bd5 100644 --- a/src/Controller/UpdateController.php +++ b/src/Controller/UpdateController.php @@ -5,6 +5,7 @@ namespace Drupal\automatic_updates\Controller; use Drupal\automatic_updates\BatchProcessor; use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Messenger\MessengerInterface; +use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\State\StateInterface; use Drupal\Core\Url; use Drupal\package_manager\Validator\PendingUpdatesValidator; @@ -27,6 +28,13 @@ final class UpdateController extends ControllerBase { */ protected $pendingUpdatesValidator; + /** + * The current route match. + * + * @var \Drupal\Core\Routing\RouteMatchInterface + */ + protected $routeMatch; + /** * Constructs an UpdateController object. * @@ -34,10 +42,13 @@ final class UpdateController extends ControllerBase { * The pending updates validator. * @param \Drupal\Core\State\StateInterface $state * The state service. + * @param \Drupal\Core\Routing\RouteMatchInterface $route_match + * The current route match. */ - public function __construct(PendingUpdatesValidator $pending_updates_validator, StateInterface $state) { + public function __construct(PendingUpdatesValidator $pending_updates_validator, StateInterface $state, RouteMatchInterface $route_match) { $this->pendingUpdatesValidator = $pending_updates_validator; $this->stateService = $state; + $this->routeMatch = $route_match; } /** @@ -46,7 +57,8 @@ final class UpdateController extends ControllerBase { public static function create(ContainerInterface $container) { return new static( $container->get('package_manager.validator.pending_updates'), - $container->get('state') + $container->get('state'), + $container->get('current_route_match') ); } @@ -92,4 +104,48 @@ final class UpdateController extends ControllerBase { return new RedirectResponse($url->setAbsolute()->toString()); } + /** + * Redirects deprecated routes and sets an informative message. + * + * @param \Symfony\Component\HttpFoundation\Request $request + * The current request. + * + * @return \Symfony\Component\HttpFoundation\RedirectResponse + * A redirect response. + */ + public function redirectDeprecatedRoute(Request $request): RedirectResponse { + $route_name = $this->routeMatch->getRouteName(); + + switch ($route_name) { + case 'automatic_updates.module_update': + $destination = 'update.module_update'; + break; + + case 'automatic_updates.theme_update': + $destination = 'update.theme_update'; + break; + + case 'automatic_updates.report_update': + $destination = 'update.report_update'; + break; + + default: + throw new \InvalidArgumentException("Unknown route: '$route_name'"); + } + $destination = Url::fromRoute($destination) + ->setAbsolute() + ->toString(); + + $message = $this->t('This page was accessed from @deprecated_url, which is deprecated and will not work in the next major version of Automatic Updates. Please use <a href=":correct_url">@correct_url</a> instead.', [ + '@deprecated_url' => $request->getUri(), + ':correct_url' => $destination, + '@correct_url' => $destination, + ]); + $this->messenger()->addStatus($message); + + // 308 is a permanent redirect regardless of HTTP method. + // @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections + return new RedirectResponse($destination, 308); + } + } diff --git a/src/Form/UpdateReady.php b/src/Form/UpdateReady.php index 0f33929e617b515e5f50bd43a011b8fde784b36a..fab06f14e1e9c1bdd9a855316422389ce5c0b6ed 100644 --- a/src/Form/UpdateReady.php +++ b/src/Form/UpdateReady.php @@ -267,7 +267,7 @@ final class UpdateReady extends FormBase { try { $this->updater->destroy(); $this->messenger()->addStatus($this->t('The update was successfully cancelled.')); - $form_state->setRedirect('automatic_updates.report_update'); + $form_state->setRedirect('update.report_update'); } catch (StageException $e) { $this->messenger()->addError($e->getMessage()); diff --git a/src/Routing/RouteSubscriber.php b/src/Routing/RouteSubscriber.php index de0069bf430d988d7bcd7b4bc99bb97d9b478917..3b794b7115063f932bdd0faef2f97c2317e23aed 100644 --- a/src/Routing/RouteSubscriber.php +++ b/src/Routing/RouteSubscriber.php @@ -2,7 +2,10 @@ namespace Drupal\automatic_updates\Routing; +use Drupal\automatic_updates\Form\UpdaterForm; use Drupal\Core\Routing\RouteSubscriberBase; +use Drupal\Core\Routing\RoutingEvents; +use Symfony\Component\Routing\Route; use Symfony\Component\Routing\RouteCollection; /** @@ -15,17 +18,26 @@ use Symfony\Component\Routing\RouteCollection; */ final class RouteSubscriber extends RouteSubscriberBase { + /** + * {@inheritdoc} + */ + public static function getSubscribedEvents() { + return [ + // Try to run after other route subscribers, to minimize the chances of + // conflicting with other code that is modifying Update module routes. + RoutingEvents::ALTER => ['onAlterRoutes', -1000], + ]; + } + /** * {@inheritdoc} */ protected function alterRoutes(RouteCollection $collection) { + // Disable readiness checks on certain routes. $disabled_routes = [ - 'update.theme_update', 'system.theme_install', - 'update.module_update', 'update.module_install', 'update.status', - 'update.report_update', 'update.report_install', 'update.settings', 'system.status', @@ -38,6 +50,35 @@ final class RouteSubscriber extends RouteSubscriberBase { $route->setOption('_automatic_updates_readiness_messages', 'skip'); } } + + // Take over the routes defined by the core Update module. + $update_module_routes = [ + 'update.report_update', + 'update.module_update', + 'update.theme_update', + ]; + $defaults = [ + '_form' => UpdaterForm::class, + '_title' => 'Update', + ]; + // Completely redefine the access requirements to disable incompatible + // requirements defined on the core routes, like `_access_update_manager`, + // which would allow access to our forms if the `allow_authorize_operations` + // setting is enabled. + $requirements = [ + '_permission' => 'administer software updates', + ]; + $options = [ + '_admin_route' => TRUE, + '_maintenance_access' => TRUE, + '_automatic_updates_readiness_messages' => 'skip', + ]; + foreach ($update_module_routes as $name) { + $route = $collection->get($name); + if ($route) { + $collection->add($name, new Route($route->getPath(), $defaults, $requirements, $options)); + } + } } } diff --git a/src/Validator/VersionPolicy/SupportedBranchInstalled.php b/src/Validator/VersionPolicy/SupportedBranchInstalled.php index 247793a1a007ae4a0599ce765b9c7a13cce19a6e..a76ed911d3064e5e7a5d78d06c3e7ad2cb60c9ac 100644 --- a/src/Validator/VersionPolicy/SupportedBranchInstalled.php +++ b/src/Validator/VersionPolicy/SupportedBranchInstalled.php @@ -96,7 +96,7 @@ final class SupportedBranchInstalled implements ContainerInjectionInterface { if ($in_supported_major && $allow_minor_updates) { $messages[] = $this->t('Use the <a href=":url">update form</a> to update to a supported version.', [ - ':url' => Url::fromRoute('automatic_updates.module_update')->toString(), + ':url' => Url::fromRoute('update.module_update')->toString(), ]); } else { diff --git a/tests/src/Build/CoreUpdateTest.php b/tests/src/Build/CoreUpdateTest.php index 6e64aca6183ed1b82ba299556fc30968c2da03c1..ecf157ad874f932c7e5480280ecca831f15c7a7b 100644 --- a/tests/src/Build/CoreUpdateTest.php +++ b/tests/src/Build/CoreUpdateTest.php @@ -51,7 +51,7 @@ class CoreUpdateTest extends UpdateTestBase { // about available updates and ensure that an update to 9.8.1 is available. $this->assertCoreVersion('9.8.0'); $this->checkForUpdates(); - $this->visit('/admin/modules/automatic-update'); + $this->visit('/admin/modules/update'); $this->getMink()->assertSession()->pageTextContains('9.8.1'); // Ensure that Drupal has write-protected the site directory. @@ -238,7 +238,7 @@ class CoreUpdateTest extends UpdateTestBase { // @todo Figure out why this assertion fails when the batch processor // redirects directly to the update form, instead of update.status, when // updating via the UI. - $this->visit('/admin/modules/automatic-update'); + $this->visit('/admin/modules/update'); $this->getMink()->assertSession()->pageTextContains('No update available'); // The status page should report that we're running the expected version and diff --git a/tests/src/Functional/AvailableUpdatesReportTest.php b/tests/src/Functional/AvailableUpdatesReportTest.php index 09b7d2b02215f6cd5f39f4c626bb4a92105d9403..896c162199d92fc963fc61a045ed600b218381ce 100644 --- a/tests/src/Functional/AvailableUpdatesReportTest.php +++ b/tests/src/Functional/AvailableUpdatesReportTest.php @@ -44,7 +44,7 @@ class AvailableUpdatesReportTest extends AutomaticUpdatesFunctionalTestBase { */ public function testReportLinks(): void { $assert = $this->assertSession(); - $form_url = Url::fromRoute('automatic_updates.report_update')->toString(); + $form_url = Url::fromRoute('update.report_update')->toString(); $this->config('automatic_updates.settings')->set('allow_core_minor_updates', TRUE)->save(); $fixture_directory = __DIR__ . '/../../../package_manager/tests/fixtures/release-history'; diff --git a/tests/src/Functional/DeprecatedRoutesTest.php b/tests/src/Functional/DeprecatedRoutesTest.php new file mode 100644 index 0000000000000000000000000000000000000000..a954459dc1a6b63cb01bc57a82b6d60d2a98bf72 --- /dev/null +++ b/tests/src/Functional/DeprecatedRoutesTest.php @@ -0,0 +1,55 @@ +<?php + +namespace Drupal\Tests\automatic_updates\Functional; + +use Drupal\Core\Url; + +/** + * @covers \Drupal\automatic_updates\Controller\UpdateController::redirectDeprecatedRoute + * @covers \Drupal\automatic_updates\Routing\RouteSubscriber + * + * @group automatic_updates + * @group legacy + */ +class DeprecatedRoutesTest extends AutomaticUpdatesFunctionalTestBase { + + /** + * {@inheritdoc} + */ + protected static $modules = ['automatic_updates']; + + /** + * {@inheritdoc} + */ + protected $defaultTheme = 'stark'; + + /** + * Tests that deprecated routes are redirected with an informative message. + */ + public function testDeprecatedRoutesAreRedirected(): void { + $account = $this->createUser(['administer software updates']); + $this->drupalLogin($account); + + $routes = [ + 'automatic_updates.module_update' => 'update.module_update', + 'automatic_updates.report_update' => 'update.report_update', + 'automatic_updates.theme_update' => 'update.theme_update', + ]; + $assert_session = $this->assertSession(); + + foreach ($routes as $deprecated_route => $redirect_route) { + $deprecated_url = Url::fromRoute($deprecated_route) + ->setAbsolute() + ->toString(); + $redirect_url = Url::fromRoute($redirect_route) + ->setAbsolute() + ->toString(); + + $this->drupalGet($deprecated_url); + $assert_session->statusCodeEquals(200); + $assert_session->addressEquals($redirect_url); + $assert_session->responseContains("This page was accessed from $deprecated_url, which is deprecated and will not work in the next major version of Automatic Updates. Please use <a href=\"$redirect_url\">$redirect_url</a> instead."); + } + } + +} diff --git a/tests/src/Functional/ReadinessValidationTest.php b/tests/src/Functional/ReadinessValidationTest.php index fd63cc6d872701f168b4a57677e7aa9251e70e2a..cbb06f50f4bc541d6ac3dd498bea4b8e71da7d85 100644 --- a/tests/src/Functional/ReadinessValidationTest.php +++ b/tests/src/Functional/ReadinessValidationTest.php @@ -422,7 +422,7 @@ class ReadinessValidationTest extends AutomaticUpdatesFunctionalTestBase { // during it. The Update button is displayed because the form does its own // readiness check (without storing the results), and the checker is no // longer raising an error. - $this->drupalGet('/admin/modules/automatic-update'); + $this->drupalGet('/admin/modules/update'); $this->useFixtureDirectoryAsStaged(__DIR__ . '/../../fixtures/drupal-9.8.1-installed'); $assert_session->buttonExists('Update'); // Ensure that the previous results are still displayed on another admin @@ -431,7 +431,7 @@ class ReadinessValidationTest extends AutomaticUpdatesFunctionalTestBase { $this->drupalGet('/admin/structure'); $assert_session->pageTextContains($message); // Proceed with the update. - $this->drupalGet('/admin/modules/automatic-update'); + $this->drupalGet('/admin/modules/update'); $page->pressButton('Update'); $this->checkForMetaRefresh(); $this->assertUpdateReady('9.8.1'); diff --git a/tests/src/Functional/UpdateLockTest.php b/tests/src/Functional/UpdateLockTest.php index 48ae0aa3d6c3f1c1ed10d4933c36ddb65606dbf2..37ef6a44595c95a91af7f8c7c4f358518699d478 100644 --- a/tests/src/Functional/UpdateLockTest.php +++ b/tests/src/Functional/UpdateLockTest.php @@ -51,7 +51,7 @@ class UpdateLockTest extends AutomaticUpdatesFunctionalTestBase { // We should be able to get partway through an update without issue. $this->drupalLogin($user_1); - $this->drupalGet('/admin/modules/automatic-update'); + $this->drupalGet('/admin/modules/update'); Stager::setFixturePath(__DIR__ . '/../../fixtures/drupal-9.8.1-installed'); $page->pressButton('Update'); $this->checkForMetaRefresh(); @@ -62,7 +62,7 @@ class UpdateLockTest extends AutomaticUpdatesFunctionalTestBase { // Another user cannot show up and try to start an update, since the other // user already started one. $this->drupalLogin($user_2); - $this->drupalGet('/admin/modules/automatic-update'); + $this->drupalGet('/admin/modules/update'); $assert_session->buttonNotExists('Update'); $assert_session->pageTextContains('Cannot begin an update because another Composer operation is currently in progress.'); diff --git a/tests/src/Functional/UpdaterFormNoRecommendedReleaseMessageTest.php b/tests/src/Functional/UpdaterFormNoRecommendedReleaseMessageTest.php index ee277626641c352e5dec08280b945be0c81f7706..455fe0d806c8739841de3fa05c0d5dd4b81ecfd6 100644 --- a/tests/src/Functional/UpdaterFormNoRecommendedReleaseMessageTest.php +++ b/tests/src/Functional/UpdaterFormNoRecommendedReleaseMessageTest.php @@ -84,7 +84,7 @@ class UpdaterFormNoRecommendedReleaseMessageTest extends AutomaticUpdatesFunctio $this->setReleaseMetadata($release_metadata); $this->setCoreVersion($installed_version); $this->checkForUpdates(); - $this->drupalGet('/admin/reports/updates/automatic-update'); + $this->drupalGet('/admin/reports/updates/update'); $assert_session = $this->assertSession(); // BEGIN: DELETE FROM CORE MERGE REQUEST diff --git a/tests/src/Functional/UpdaterFormTest.php b/tests/src/Functional/UpdaterFormTest.php index 1612591efd73964a3ab43e609dee9db533366d09..db866a7bf8951892bd20af66a324f098eb572e2a 100644 --- a/tests/src/Functional/UpdaterFormTest.php +++ b/tests/src/Functional/UpdaterFormTest.php @@ -76,8 +76,8 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { */ public function providerUpdateFormReferringUrl(): array { return [ - 'Modules page' => ['/admin/modules/automatic-update'], - 'Reports page' => ['/admin/reports/updates/automatic-update'], + 'Modules page' => ['/admin/modules/update'], + 'Reports page' => ['/admin/reports/updates/update'], ]; } @@ -264,7 +264,7 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { // If a validator raises an error during readiness checking, the form should // not have a submit button. - $this->drupalGet('/admin/modules/automatic-update'); + $this->drupalGet('/admin/modules/update'); $this->assertNoUpdateButtons(); // Since this is an administrative page, the error message should be visible // thanks to automatic_updates_page_top(). The readiness checks were re-run @@ -385,7 +385,7 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { $this->setCoreVersion('9.8.0'); $this->checkForUpdates(); - $this->drupalGet('/admin/modules/automatic-update'); + $this->drupalGet('/admin/modules/update'); Stager::setFixturePath(__DIR__ . '/../../fixtures/drupal-9.8.1-installed'); $page->pressButton('Update to 9.8.1'); $this->checkForMetaRefresh(); @@ -397,12 +397,12 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { // If we try to return to the start page, we should be redirected back to // the confirmation page. - $this->drupalGet('/admin/modules/automatic-update'); + $this->drupalGet('/admin/modules/update'); $this->assertUpdateReady('9.8.1'); // Delete the existing update. $page->pressButton('Cancel update'); - $assert_session->addressEquals('/admin/reports/updates/automatic-update'); + $assert_session->addressEquals('/admin/reports/updates/update'); $assert_session->pageTextContains($cancelled_message); $assert_session->pageTextNotContains($conflict_message); // Ensure we can start another update after deleting the existing one. @@ -418,7 +418,7 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { // update because the previous session already started one. $account = $this->createUser([], NULL, TRUE); $this->drupalLogin($account); - $this->drupalGet('/admin/reports/updates/automatic-update'); + $this->drupalGet('/admin/reports/updates/update'); $assert_session->pageTextContains($conflict_message); $this->assertNoUpdateButtons(); // We should be able to delete the previous update, then start a new one. @@ -450,7 +450,7 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { 'access site in maintenance mode', ]); $this->drupalLogin($user); - $this->drupalGet('/admin/reports/updates/automatic-update'); + $this->drupalGet('/admin/reports/updates/update'); $assert_session->pageTextContains($conflict_message); $page->pressButton('Delete existing update'); $assert_session->statusCodeEquals(200); @@ -520,7 +520,7 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { StagedDatabaseUpdateValidator::setExtensionsWithUpdates(['system', 'automatic_updates_theme_with_updates']); $page = $this->getSession()->getPage(); - $this->drupalGet('/admin/modules/automatic-update'); + $this->drupalGet('/admin/modules/update'); Stager::setFixturePath(__DIR__ . '/../../fixtures/drupal-9.8.1-installed'); // The warning should be visible. $assert_session = $this->assertSession(); @@ -591,19 +591,19 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { public function providerSuccessfulUpdate(): array { return [ 'Modules page, maintenance mode on' => [ - '/admin/modules/automatic-update', + '/admin/modules/update', TRUE, ], 'Modules page, maintenance mode off' => [ - '/admin/modules/automatic-update', + '/admin/modules/update', FALSE, ], 'Reports page, maintenance mode on' => [ - '/admin/reports/updates/automatic-update', + '/admin/reports/updates/update', TRUE, ], 'Reports page, maintenance mode off' => [ - '/admin/reports/updates/automatic-update', + '/admin/reports/updates/update', FALSE, ], ]; @@ -707,7 +707,7 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { $this->checkForUpdates(); $page = $this->getSession()->getPage(); - $this->drupalGet('/admin/modules/automatic-update'); + $this->drupalGet('/admin/modules/update'); Stager::setFixturePath(__DIR__ . '/../../fixtures/drupal-9.8.1-installed'); $page->pressButton('Update to 9.8.1'); $this->checkForMetaRefresh(); @@ -728,7 +728,7 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { // We should be able to start over without any problems, and the error // message should not be seen on the updater form. $page->pressButton('Cancel update'); - $assert_session->addressEquals('/admin/reports/updates/automatic-update'); + $assert_session->addressEquals('/admin/reports/updates/update'); $assert_session->pageTextNotContains($error_message); $assert_session->pageTextContains('The update was successfully cancelled.'); $assert_session->buttonExists('Update'); @@ -744,7 +744,7 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { $this->setCoreVersion('9.8.0'); $this->checkForUpdates(); - $this->drupalGet('/admin/modules/automatic-update'); + $this->drupalGet('/admin/modules/update'); $error = new \Exception('Some Exception'); TestSubscriber1::setException($error, PostRequireEvent::class); $assert_session->pageTextNotContains(static::$errorsExplanation); @@ -754,7 +754,7 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { $this->assertUpdateStagedTimes(1); $assert_session->pageTextContainsOnce('An error has occurred.'); $page->clickLink('the error page'); - $assert_session->addressEquals('/admin/modules/automatic-update'); + $assert_session->addressEquals('/admin/modules/update'); $assert_session->pageTextNotContains('Cannot begin an update because another Composer operation is currently in progress.'); $assert_session->buttonNotExists('Delete existing update'); $assert_session->pageTextContains('Some Exception'); diff --git a/tests/src/Kernel/ReadinessValidation/VersionPolicy/SupportedBranchInstalledTest.php b/tests/src/Kernel/ReadinessValidation/VersionPolicy/SupportedBranchInstalledTest.php index 79cb0320b1fde53f6e7f616fe291f8bbf9745a6b..84bd5a7528fa4f744dc1390ca538f1a54fae7fc2 100644 --- a/tests/src/Kernel/ReadinessValidation/VersionPolicy/SupportedBranchInstalledTest.php +++ b/tests/src/Kernel/ReadinessValidation/VersionPolicy/SupportedBranchInstalledTest.php @@ -45,7 +45,7 @@ class SupportedBranchInstalledTest extends AutomaticUpdatesKernelTestBase { [TRUE], [ 'The currently installed version of Drupal core, 9.6.1, is not in a supported minor version. Your site will not be automatically updated during cron until it is updated to a supported minor version.', - 'Use the <a href="/admin/modules/automatic-update">update form</a> to update to a supported version.', + 'Use the <a href="/admin/modules/update">update form</a> to update to a supported version.', ], ], 'unsupported version installed' => [ diff --git a/tests/src/Kernel/ReadinessValidation/VersionPolicyValidatorTest.php b/tests/src/Kernel/ReadinessValidation/VersionPolicyValidatorTest.php index 087720c2e31213cfadeb6833c2bec7a19634311b..cb25b386949f40f720146c650df5b1cfef65b657 100644 --- a/tests/src/Kernel/ReadinessValidation/VersionPolicyValidatorTest.php +++ b/tests/src/Kernel/ReadinessValidation/VersionPolicyValidatorTest.php @@ -145,7 +145,7 @@ class VersionPolicyValidatorTest extends AutomaticUpdatesKernelTestBase { [ $this->createVersionPolicyValidationResult('9.7.1', NULL, [ 'The currently installed version of Drupal core, 9.7.1, is not in a supported minor version. Your site will not be automatically updated during cron until it is updated to a supported minor version.', - 'Use the <a href="/admin/modules/automatic-update">update form</a> to update to a supported version.', + 'Use the <a href="/admin/modules/update">update form</a> to update to a supported version.', ]), ], TRUE,