function FieldTypePluginManagerTest::enableAllCoreModules

Same name and namespace in other branches
  1. 9 core/modules/field/tests/src/Kernel/FieldTypePluginManagerTest.php \Drupal\Tests\field\Kernel\FieldTypePluginManagerTest::enableAllCoreModules()
  2. 8.9.x core/modules/field/tests/src/Kernel/FieldTypePluginManagerTest.php \Drupal\Tests\field\Kernel\FieldTypePluginManagerTest::enableAllCoreModules()
  3. 11.x core/modules/field/tests/src/Kernel/FieldTypePluginManagerTest.php \Drupal\Tests\field\Kernel\FieldTypePluginManagerTest::enableAllCoreModules()

Enable all core modules.

1 call to FieldTypePluginManagerTest::enableAllCoreModules()
FieldTypePluginManagerTest::testMainProperty in core/modules/field/tests/src/Kernel/FieldTypePluginManagerTest.php
Tests all field items provide an existing main property.

File

core/modules/field/tests/src/Kernel/FieldTypePluginManagerTest.php, line 128

Class

FieldTypePluginManagerTest
Tests the field type manager.

Namespace

Drupal\Tests\field\Kernel

Code

protected function enableAllCoreModules() {
    $listing = new ExtensionDiscovery($this->root);
    $module_list = $listing->scan('module', FALSE);
    
    /** @var \Drupal\Core\Extension\ModuleHandlerInterface $module_handler */
    $module_handler = $this->container
        ->get('module_handler');
    $module_list = array_filter(array_keys($module_list), function ($module) use ($module_handler, $module_list) {
        return !$module_handler->moduleExists($module) && str_starts_with($module_list[$module]->getPath(), 'core');
    });
    $this->enableModules($module_list);
}

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