class ModuleDeprecationTest
Tests module file extension deprecations.
Attributes
#[Group('Module')]
#[RunTestsInSeparateProcesses]
Hierarchy
- class \Drupal\Tests\DrupalTestCase uses \Drupal\Tests\DrupalTestCaseTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\KernelTests\KernelTestBase implements \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Prophecy\PhpUnit\ProphecyTrait, \Drupal\Tests\BrowserHtmlDebugTrait, \Drupal\Tests\HttpKernelUiHelperTrait extends \Drupal\Tests\DrupalTestCase
- class \Drupal\Tests\system\Kernel\Module\ModuleDeprecationTest extends \Drupal\KernelTests\KernelTestBase
- class \Drupal\KernelTests\KernelTestBase implements \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Prophecy\PhpUnit\ProphecyTrait, \Drupal\Tests\BrowserHtmlDebugTrait, \Drupal\Tests\HttpKernelUiHelperTrait extends \Drupal\Tests\DrupalTestCase
Expanded class hierarchy of ModuleDeprecationTest
File
-
core/
modules/ system/ tests/ src/ Kernel/ Module/ ModuleDeprecationTest.php, line 15
Namespace
Drupal\Tests\system\Kernel\ModuleView 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.