function ModuleHandlerTest::testAutoloadHookInfoFiles
Tests autoloading .token and .view files.
@group legacy
File
-
core/
modules/ system/ tests/ src/ Kernel/ Extension/ ModuleHandlerTest.php, line 439
Class
- ModuleHandlerTest
- Tests ModuleHandler functionality.
Namespace
Drupal\Tests\system\Kernel\ExtensionCode
public function testAutoloadHookInfoFiles() : void {
$this->expectDeprecation('Autoloading hooks in the file (core/modules/system/tests/modules/module_test/module_test.tokens.inc) is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Move the functions in this file to either the .module file or other appropriate location. See https://www.drupal.org/node/3489765');
$this->moduleInstaller()
->install([
'module_test',
]);
$testToken = [];
$testToken['types']['token_info_invoked'] = [
'name' => 'tokens.inc test',
'description' => 'tokens.inc test',
];
$testToken['tokens']['token_info_invoked']['token_test_1'] = [
'type' => 'text',
'name' => 'tokens.inc test 1',
];
$this->assertTrue($this->moduleHandler()
->hasImplementations('token_info', [
'module_test',
]));
$this->assertEquals($testToken, $this->moduleHandler()
->invoke('module_test', 'token_info', []));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.