function KernelTestBaseTest::testEnableModulesLoad
Tests expected load behavior of enableModules().
File
-
core/
modules/ simpletest/ src/ Tests/ KernelTestBaseTest.php, line 82
Class
- KernelTestBaseTest
- Tests KernelTestBase functionality.
Namespace
Drupal\simpletest\TestsCode
public function testEnableModulesLoad() {
$module = 'field_test';
// Verify that the module does not exist yet.
$this->assertFalse(\Drupal::moduleHandler()->moduleExists($module), "{$module} module not found.");
$list = array_keys(\Drupal::moduleHandler()->getModuleList());
$this->assertFalse(in_array($module, $list), "{$module} module not found in the extension handler's module list.");
$list = \Drupal::moduleHandler()->getImplementations('entity_display_build_alter');
$this->assertFalse(in_array($module, $list), "{$module}_entity_display_build_alter() in \\Drupal::moduleHandler()->getImplementations() not found.");
// Enable the module.
$this->enableModules([
$module,
]);
// Verify that the module exists.
$this->assertTrue(\Drupal::moduleHandler()->moduleExists($module), "{$module} module found.");
$list = array_keys(\Drupal::moduleHandler()->getModuleList());
$this->assertTrue(in_array($module, $list), "{$module} module found in the extension handler's module list.");
$list = \Drupal::moduleHandler()->getImplementations('query_efq_table_prefixing_test_alter');
$this->assertTrue(in_array($module, $list), "{$module}_query_efq_table_prefixing_test_alter() in \\Drupal::moduleHandler()->getImplementations() found.");
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.