Unverified Commit 20205709 authored by Alex Pott's avatar Alex Pott
Browse files

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

parent 70eb124d
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -153,8 +153,14 @@ function _update_fix_missing_schema() {
 *   Name of the module.
 * @param string $schema_version
 *   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) {
  @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::service('extension.list.profile')->reset();
  \Drupal::service('extension.list.module')->reset();
+0 −7
Original line number Diff line number Diff line
@@ -78,13 +78,6 @@ public function testUpdateHooks() {
    $this->assertEqual(8001, drupal_get_installed_schema_version('update_test_schema', TRUE));
    // 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.');

    // 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'));

  }

}
+12 −0
Original line number Diff line number Diff line
@@ -9,6 +9,8 @@
 *
 * @group legacy
 * @group extension
 *
 * @todo Remove in https://www.drupal.org/node/3210931
 */
class UpdateDeprecationTest extends KernelTestBase {

@@ -31,4 +33,14 @@ public function testUpdateCheckIncompatibility() {
    $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'));
  }

}