class InfoAlterTest
Same name and namespace in other branches
- 11.x core/modules/system/tests/src/Kernel/System/InfoAlterTest.php \Drupal\Tests\system\Kernel\System\InfoAlterTest
Tests the effectiveness of hook_system_info_alter().
@group system
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertLegacyTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\Tests\system\Kernel\System\InfoAlterTest implements \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of InfoAlterTest
File
-
core/
modules/ system/ tests/ src/ Kernel/ System/ InfoAlterTest.php, line 12
Namespace
Drupal\Tests\system\Kernel\SystemView source
class InfoAlterTest extends KernelTestBase {
protected static $modules = [
'system',
];
/**
* Tests that theme .info.yml data is rebuild after enabling a module.
*
* Tests that info data is rebuilt after a module that implements
* hook_system_info_alter() is enabled. Also tests if core *_list() functions
* return freshly altered info.
*/
public function testSystemInfoAlter() {
\Drupal::state()->set('module_required_test.hook_system_info_alter', TRUE);
$info = \Drupal::service('extension.list.module')->getList();
$this->assertFalse(isset($info['node']->info['required']), 'Before the module_required_test is installed the node module is not required.');
// Enable the test module.
\Drupal::service('module_installer')->install([
'module_required_test',
], FALSE);
$this->assertTrue(\Drupal::moduleHandler()->moduleExists('module_required_test'), 'Test required module is enabled.');
$info = \Drupal::service('extension.list.module')->getList();
$this->assertTrue($info['node']->info['required'], 'After the module_required_test is installed the node module is required.');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.