drupal-8.update-test-semver-update-n-enabled.php

Same filename in other branches
  1. 9 core/modules/system/tests/fixtures/update/drupal-8.update-test-semver-update-n-enabled.php
  2. 10 core/modules/system/tests/fixtures/update/drupal-8.update-test-semver-update-n-enabled.php
  3. 11.x core/modules/system/tests/fixtures/update/drupal-8.update-test-semver-update-n-enabled.php

Database to mimic the installation of the update_test_semver_update_n module.

File

core/modules/system/tests/fixtures/update/drupal-8.update-test-semver-update-n-enabled.php

View source
<?php


/**
 * @file
 * Database to mimic the installation of the update_test_semver_update_n module.
 */
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
// Set the schema version.
$connection->merge('key_value')
    ->condition('collection', 'system.schema')
    ->condition('name', 'update_test_semver_update_n')
    ->fields([
    'collection' => 'system.schema',
    'name' => 'update_test_semver_update_n',
    'value' => 'i:8000;',
])
    ->execute();
// Update core.extension.
$extensions = $connection->select('config')
    ->fields('config', [
    'data',
])
    ->condition('collection', '')
    ->condition('name', 'core.extension')
    ->execute()
    ->fetchField();
$extensions = unserialize($extensions);
$extensions['module']['update_test_semver_update_n'] = 8000;
$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.