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
No related merge requests found
name: 'Update test with update_last_removed implementation'
name: 'Update test with hook_update_last_removed() implementation'
type: module
description: 'Support module for update testing.'
package: Testing
......
......@@ -2,11 +2,11 @@
/**
* @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() {
return 8002;
......
......@@ -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() {
drupal_set_installed_schema_version('update_test_last_removed', 8000);
drupal_set_installed_schema_version('system', 8804);
// Access the update page with too old versions for system and the test
// module, only the generic core message should be shown.
// Access the update page with a schema version that is too old for system
// and the test module, only the generic core message should be shown.
$this->drupalLogin($this->updateUser);
$this->drupalGet($this->updateUrl);
$assert_session = $this->assertSession();
$assert_session->pageTextContains('Requirements problem');
$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->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');
......@@ -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->pageTextContains('Unsupported schema version: Update test with 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('Unsupported schema version: Update test with hook_update_last_removed() implementation');
$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');
// Set the expected schema version for the node and test module, updates are
......
......@@ -58,7 +58,8 @@ protected function runUpdates($update_url = NULL) {
$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);
foreach (['update', 'post_update'] as $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