public static function UpdatePathTestInstallHelper::enableExtension in Style Switcher 8.2
Same name and namespace in other branches
- 3.0.x tests/src/Functional/Update/UpdatePathTestInstallHelper.php \Drupal\Tests\styleswitcher\Functional\Update\UpdatePathTestInstallHelper::enableExtension()
Enables a module or theme by adding it to the core.extension config.
Parameters
string $name: Extension name.
int $weight: (optional) Extension weight.
string $type: (optional) Extension type (module/theme).
1 call to UpdatePathTestInstallHelper::enableExtension()
- drupal-8.8.0.styleswitcher.php in tests/
fixtures/ update/ 8201/ drupal-8.8.0.styleswitcher.php - DB additions for the update path testing of styleswitcher_update_8201().
File
- tests/
src/ Functional/ Update/ UpdatePathTestInstallHelper.php, line 45
Class
- UpdatePathTestInstallHelper
- Helps install database additions for a testing of update paths.
Namespace
Drupal\Tests\styleswitcher\Functional\UpdateCode
public static function enableExtension(string $name, int $weight = 0, string $type = 'module') {
$extensions = static::getConnection()
->select('config')
->fields('config', [
'data',
])
->condition('collection', '')
->condition('name', 'core.extension')
->execute()
->fetchField();
$extensions = unserialize($extensions);
$extensions[$type][$name] = $weight;
$extensions = serialize($extensions);
static::getConnection()
->update('config')
->fields([
'data' => $extensions,
])
->condition('collection', '')
->condition('name', 'core.extension')
->execute();
}