class ModuleDeprecationTest

Tests module file extension deprecations.

Attributes

#[Group('Module')] #[RunTestsInSeparateProcesses]

Hierarchy

Expanded class hierarchy of ModuleDeprecationTest

File

core/modules/system/tests/src/Kernel/Module/ModuleDeprecationTest.php, line 15

Namespace

Drupal\Tests\system\Kernel\Module
View source
class ModuleDeprecationTest extends KernelTestBase {
  
  /**
   * Tests that .module deprecations are emitted.
   */
  public function testModuleExtensionDeprecation() : void {
    \Drupal::service('module_installer')->install([
      'test_module_discovery_deprecation',
    ]);
    $this->expectUserDeprecationMessage('Code in test_module_discovery_deprecation.module is deprecated in drupal:11.5.0 and must be converted before drupal:13.0.0. Use classes instead. See https://www.drupal.org/node/3619765');
  }
  
  /**
   * Tests the deprecation is emitted when procedural hook scanning is skipped.
   */
  public function testSkipProceduralDeprecation() : void {
    $this->expectUserDeprecationMessage('Code in hook_collector_skip_procedural.module is deprecated in drupal:11.5.0 and must be converted before drupal:13.0.0. Use classes instead. See https://www.drupal.org/node/3619765');
    \Drupal::service('module_installer')->install([
      'hook_collector_skip_procedural',
    ]);
  }
  
  /**
   * Tests the deprecation is emitted when the first function stops the scan.
   */
  public function testFirstFunctionScanStopDeprecation() : void {
    $this->expectUserDeprecationMessage('Code in test_module_scan_stop_deprecation.module is deprecated in drupal:11.5.0 and must be converted before drupal:13.0.0. Use classes instead. See https://www.drupal.org/node/3619765');
    \Drupal::service('module_installer')->install([
      'test_module_scan_stop_deprecation',
    ]);
  }

}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.