function ViewsConfigUpdaterTest::setUp

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Kernel/ViewsConfigUpdaterTest.php \Drupal\Tests\views\Kernel\ViewsConfigUpdaterTest::setUp()
  2. 8.9.x core/modules/views/tests/src/Kernel/ViewsConfigUpdaterTest.php \Drupal\Tests\views\Kernel\ViewsConfigUpdaterTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/views/tests/src/Functional/ViewsConfigUpdaterTest.php, line 35

Class

ViewsConfigUpdaterTest
Tests the views config updater service.

Namespace

Drupal\Tests\views\Functional

Code

protected function setUp() : void {
  parent::setUp();
  $connection = Database::getConnection();
  // Enable views_test_config_updater via the database so post_update hooks
  // can run.
  $extensions = $connection->select('config')
    ->fields('config', [
    'data',
  ])
    ->condition('collection', '')
    ->condition('name', 'core.extension')
    ->execute()
    ->fetchField();
  $extensions = unserialize($extensions);
  $extensions['module']['views_test_config_updater'] = 0;
  $connection->update('config')
    ->fields([
    'data' => serialize($extensions),
  ])
    ->condition('collection', '')
    ->condition('name', 'core.extension')
    ->execute();
}

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