Unverified Commit 20205709 authored by alexpott's avatar alexpott
Browse files

Issue #3210900 by andypost, longwave: Deprecate update_set_schema() for removal

parent 70eb124d
...@@ -153,8 +153,14 @@ function _update_fix_missing_schema() { ...@@ -153,8 +153,14 @@ function _update_fix_missing_schema() {
* Name of the module. * Name of the module.
* @param string $schema_version * @param string $schema_version
* The schema version the module should be set to. * The schema version the module should be set to.
*
* @deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. No direct
* replacement is provided.
*
* @see https://www.drupal.org/node/3210925
*/ */
function update_set_schema($module, $schema_version) { function update_set_schema($module, $schema_version) {
@trigger_error('update_set_schema() is deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. No direct replacement is provided. See https://www.drupal.org/node/3210925', E_USER_DEPRECATED);
\Drupal::keyValue('system.schema')->set($module, $schema_version); \Drupal::keyValue('system.schema')->set($module, $schema_version);
\Drupal::service('extension.list.profile')->reset(); \Drupal::service('extension.list.profile')->reset();
\Drupal::service('extension.list.module')->reset(); \Drupal::service('extension.list.module')->reset();
......
...@@ -78,13 +78,6 @@ public function testUpdateHooks() { ...@@ -78,13 +78,6 @@ public function testUpdateHooks() {
$this->assertEqual(8001, drupal_get_installed_schema_version('update_test_schema', TRUE)); $this->assertEqual(8001, drupal_get_installed_schema_version('update_test_schema', TRUE));
// Ensure the index was added for column a. // Ensure the index was added for column a.
$this->assertTrue($connection->schema()->indexExists('update_test_schema_table', 'test'), 'Version 8001 of the update_test_schema module is installed.'); $this->assertTrue($connection->schema()->indexExists('update_test_schema_table', 'test'), 'Version 8001 of the update_test_schema module is installed.');
// Test the update_set_schema() utility function.
require_once $this->root . '/core/includes/update.inc';
update_set_schema('update_test_schema', 8003);
// Ensure schema has changed.
$this->assertEqual(8003, drupal_get_installed_schema_version('update_test_schema'));
} }
} }
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
* *
* @group legacy * @group legacy
* @group extension * @group extension
*
* @todo Remove in https://www.drupal.org/node/3210931
*/ */
class UpdateDeprecationTest extends KernelTestBase { class UpdateDeprecationTest extends KernelTestBase {
...@@ -31,4 +33,14 @@ public function testUpdateCheckIncompatibility() { ...@@ -31,4 +33,14 @@ public function testUpdateCheckIncompatibility() {
$this->assertFalse(update_check_incompatibility('system')); $this->assertFalse(update_check_incompatibility('system'));
} }
/**
* Tests update_set_schema() function.
*/
public function testUpdateSetSchema() {
$this->expectDeprecation('update_set_schema() is deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. No direct replacement is provided. See https://www.drupal.org/node/3210925');
update_set_schema('update_test_schema', 8003);
// Ensure schema has changed.
$this->assertEqual(8003, \Drupal::keyValue('system.schema')->get('update_test_schema'));
}
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment