responsive_image.php

Same filename in other branches
  1. 11.x core/modules/responsive_image/tests/fixtures/update/responsive_image.php

Test fixture.

File

core/modules/responsive_image/tests/fixtures/update/responsive_image.php

View source
<?php


/**
 * @file
 * Test fixture.
 */
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
// Set the schema version.
$connection->merge('key_value')
    ->fields([
    'value' => 'i:8000;',
    'name' => 'responsive_image',
    'collection' => 'system.schema',
])
    ->condition('collection', 'system.schema')
    ->condition('name', 'responsive_image')
    ->execute();
// Update core.extension.
$extensions = $connection->select('config')
    ->fields('config', [
    'data',
])
    ->condition('collection', '')
    ->condition('name', 'core.extension')
    ->execute()
    ->fetchField();
$extensions = unserialize($extensions);
$extensions['module']['responsive_image'] = 0;
$connection->update('config')
    ->fields([
    'data' => serialize($extensions),
])
    ->condition('collection', '')
    ->condition('name', 'core.extension')
    ->execute();
// Add all responsive_image_removed_post_updates() as existing updates.
require_once __DIR__ . '/../../../../responsive_image/responsive_image.post_update.php';
$existing_updates = $connection->select('key_value')
    ->fields('key_value', [
    'value',
])
    ->condition('collection', 'post_update')
    ->condition('name', 'existing_updates')
    ->execute()
    ->fetchField();
$existing_updates = unserialize($existing_updates);
$existing_updates = array_merge($existing_updates, array_keys(responsive_image_removed_post_updates()));
$connection->update('key_value')
    ->fields([
    'value' => serialize($existing_updates),
])
    ->condition('collection', 'post_update')
    ->condition('name', 'existing_updates')
    ->execute();

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