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

Issue #3236405 by tedbow: After update old message about security update is still displayed

parent e5d8457d
No related branches found
No related tags found
1 merge request!47Issue #3236405: After update old message about security update is still displayed
<?php
/**
* @file
* Contains hook implementations for Automatic Updates 9.3 shim module.
*/
/**
* Implements hook_page_top().
*/
function automatic_updates_9_3_shim_page_top() {
// @todo Rely on the route option after https://www.drupal.org/i/3236497 is
// committed.
// @todo Remove 'system.batch_page.html' after
// https://www.drupal.org/i/3238311 is committed.
$skip_routes = [
'system.batch_page.html',
'automatic_updates.confirmation_page',
'automatic_updates.report_update',
'automatic_updates.module_update',
];
$route_name = \Drupal::routeMatch()->getRouteName();
if (!in_array($route_name, $skip_routes, TRUE) && function_exists('update_page_top')) {
update_page_top();
}
}
/**
* Implements hook_module_implements_alter().
*
* @todo Remove after https://www.drupal.org/i/3236497 is committed.
*/
function automatic_updates_9_3_shim_module_implements_alter(&$implementations, $hook) {
if ($hook === 'page_top') {
// Remove hook_page_top() implementation from the Update module. This '
// implementation displays error messages about security releases. We call
// this implementation in our own automatic_updates_page_top() except on our
// own routes to avoid stale messages about the security releases after an
// update.
unset($implementations['update']);
}
}
......@@ -20,6 +20,7 @@
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Security update</value></term>
</terms>
</release>
<release>
......@@ -32,6 +33,7 @@
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
<term><name>Release type</name><value>Insecure</value></term>
</terms>
</release>
</releases>
......
......@@ -118,14 +118,17 @@ class CoreUpdateTest extends UpdateTestBase {
$mink = $this->getMink();
$page = $mink->getSession()->getPage();
$assert_session = $mink->assertSession();
$this->visit('/admin/modules/automatic-update');
$this->visit('/admin/modules');
$assert_session->pageTextContains('There is a security update available for your version of Drupal.');
$page->clickLink('Automatic Updates');
$assert_session->pageTextNotContains('There is a security update available for your version of Drupal.');
$page->pressButton('Download these updates');
$this->waitForBatchJob();
$assert_session->pageTextContains('Ready to update');
$page->pressButton('Continue');
$this->waitForBatchJob();
$assert_session->pageTextContains('Update complete!');
$assert_session->pageTextNotContains('There is a security update available for your version of Drupal.');
$this->assertUpdateSuccessful();
}
......
......@@ -89,18 +89,20 @@ class UpdaterFormTest extends BrowserTestBase {
$this->drupalPlaceBlock('local_tasks_block', ['primary' => TRUE]);
$assert_session = $this->assertSession();
$this->setCoreVersion('9.8.0');
$this->drupalLogin($this->rootUser);
$this->checkForUpdates();
// Navigate to the automatic updates form.
$this->drupalGet('/admin');
// @todo Add test coverage of accessing the form via the other path in
// https://www.drupal.org/i/3233564
$this->clickLink('Extend');
$assert_session->pageTextContainsOnce('There is a security update available for your version of Drupal.');
$this->clickLink('Update');
$assert_session->pageTextContainsOnce('Drupal core updates are supported by the enabled Automatic Updates module');
$this->clickLink('Automatic Updates module');
$cells = $assert_session->elementExists('css', '#edit-projects .update-recommended')
$assert_session->pageTextNotContains('There is a security update available for your version of Drupal.');
$cells = $assert_session->elementExists('css', '#edit-projects .update-update-security')
->findAll('css', 'td');
$this->assertCount(3, $cells);
$assert_session->elementExists('named', ['link', 'Drupal'], $cells[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