Skip to content
Snippets Groups Projects
Unverified Commit fd11c5a4 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3098475 by Berdir, catch, TravisCarden, xjm, benjifisher, alexpott,...

Issue #3098475 by Berdir, catch, TravisCarden, xjm, benjifisher, alexpott, larowlan, webchick, dww: Add more strict checking of hook_update_last_removed() and better explanation
parent 1b821903
No related branches found
No related tags found
6 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!1012Issue #3226887: Hreflang on non-canonical content pages,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10,!596Issue #3046532: deleting an entity reference field, used in a contextual view, makes the whole site unrecoverable,!496Issue #2463967: Use .user.ini file for PHP settings,!144Issue #2666286: Clean up menu_ui to conform to Drupal coding standards
name: 'Update test with update_last_removed implementation' name: 'Update test with hook_update_last_removed() implementation'
type: module type: module
description: 'Support module for update testing.' description: 'Support module for update testing.'
package: Testing package: Testing
......
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
/** /**
* @file * @file
* Install, update and uninstall functions for the update_test_invalid_hook module. * Update functions for the update_test_invalid_hook module.
*/ */
/** /**
* Implements hook_update_last_removed() * Implements hook_update_last_removed().
*/ */
function update_test_last_removed_update_last_removed() { function update_test_last_removed_update_last_removed() {
return 8002; return 8002;
......
...@@ -47,21 +47,21 @@ protected function setUp() { ...@@ -47,21 +47,21 @@ protected function setUp() {
} }
/** /**
* Test that a module with a too old schema version can not be updated. * Tests that a module with a too old schema version can not be updated.
*/ */
public function testLastRemovedVersion() { public function testLastRemovedVersion() {
drupal_set_installed_schema_version('update_test_last_removed', 8000); drupal_set_installed_schema_version('update_test_last_removed', 8000);
drupal_set_installed_schema_version('system', 8804); drupal_set_installed_schema_version('system', 8804);
// Access the update page with too old versions for system and the test // Access the update page with a schema version that is too old for system
// module, only the generic core message should be shown. // and the test module, only the generic core message should be shown.
$this->drupalLogin($this->updateUser); $this->drupalLogin($this->updateUser);
$this->drupalGet($this->updateUrl); $this->drupalGet($this->updateUrl);
$assert_session = $this->assertSession(); $assert_session = $this->assertSession();
$assert_session->pageTextContains('Requirements problem'); $assert_session->pageTextContains('Requirements problem');
$assert_session->pageTextContains('The version of Drupal you are trying to update from is too old'); $assert_session->pageTextContains('The version of Drupal you are trying to update from is too old');
$assert_session->pageTextContains('Updating to Drupal 9 is only supported from Drupal version 8.8.0 or higher. If you are trying to update from an older version, first update to the latest version of Drupal 8'); $assert_session->pageTextContains('Updating to Drupal 9 is only supported from Drupal version 8.8.0 or higher. If you are trying to update from an older version, first update to the latest version of Drupal 8');
$assert_session->pageTextNotContains('Unsupported schema version: Update test with update_last_removed implementation'); $assert_session->pageTextNotContains('Unsupported schema version: Update test with hook_update_last_removed() implementation');
$assert_session->linkNotExists('Continue'); $assert_session->linkNotExists('Continue');
...@@ -72,8 +72,8 @@ public function testLastRemovedVersion() { ...@@ -72,8 +72,8 @@ public function testLastRemovedVersion() {
$assert_session->pageTextNotContains('The version of Drupal you are trying to update from is too old'); $assert_session->pageTextNotContains('The version of Drupal you are trying to update from is too old');
$assert_session->pageTextContains('Unsupported schema version: Update test with update_last_removed implementation'); $assert_session->pageTextContains('Unsupported schema version: Update test with hook_update_last_removed() implementation');
$assert_session->pageTextContains('The installed version of the Update test with update_last_removed implementation module is too old to update. Update to an intermediate version first (last removed version: 8002, installed version: 8000).'); $assert_session->pageTextContains('The installed version of the Update test with hook_update_last_removed() implementation module is too old to update. Update to an intermediate version first (last removed version: 8002, installed version: 8000).');
$assert_session->linkNotExists('Continue'); $assert_session->linkNotExists('Continue');
// Set the expected schema version for the node and test module, updates are // Set the expected schema version for the node and test module, updates are
......
...@@ -58,7 +58,8 @@ protected function runUpdates($update_url = NULL) { ...@@ -58,7 +58,8 @@ protected function runUpdates($update_url = NULL) {
$this->fail('The update failed with the following message: "' . reset($failure)->getText() . '"'); $this->fail('The update failed with the following message: "' . reset($failure)->getText() . '"');
} }
// Ensure that there are no pending updates. // Ensure that there are no pending updates. Clear the schema version
// static cache first in case it was accessed before running updates.
drupal_get_installed_schema_version(NULL, TRUE); drupal_get_installed_schema_version(NULL, TRUE);
foreach (['update', 'post_update'] as $update_type) { foreach (['update', 'post_update'] as $update_type) {
switch ($update_type) { switch ($update_type) {
......
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