You are here

update.php in Lightning API 8.3

Prepares a database fixture to be updated before testing.

Forcibly uninstalls Lightning Dev, switches the installation profile from Standard to Minimal, and deletes defunct config objects.

File

tests/update.php
View source
<?php

/**
 * @file
 * Prepares a database fixture to be updated before testing.
 *
 * Forcibly uninstalls Lightning Dev, switches the installation profile from
 * Standard to Minimal, and deletes defunct config objects.
 */
use Drupal\node\Entity\NodeType;
$config_factory = Drupal::configFactory();
$config_factory
  ->getEditable('core.extension')
  ->clear('module.lightning_dev')
  ->clear('module.openapi_redoc')
  ->clear('module.standard')
  ->set('module.minimal', 1000)
  ->set('profile', 'minimal')
  ->save();
Drupal::keyValue('system.schema')
  ->deleteMultiple([
  'lightning_dev',
  'openapi_redoc',
]);
$config_factory
  ->getEditable('entity_browser.browser.media_browser')
  ->delete();
$config_factory
  ->getEditable('media.type.tweet')
  ->delete();
Drupal::service('plugin.cache_clearer')
  ->clearCachedDefinitions();

// Delete all configuration associated with the Page content type, since certain
// Behat fixture contexts reinstall Lightning Page.
$node_type = NodeType::load('page');
if ($node_type) {
  $node_type
    ->delete();
}
user_role_revoke_permissions('authenticated', [
  'use text format basic_html',
]);