Commit ce1885d1 authored by catch's avatar catch
Browse files

Issue #3119027 by Berdir, andypost: Use filled dump for RestSettingsDeletionUpdateTest

parent fd11c5a4
Loading
Loading
Loading
Loading
+0 −59
Original line number Diff line number Diff line
<?php

/**
 * @file
 * Test fixture for \Drupal\Tests\rest\Functional\Update\RestExportAuthCorrectionUpdateTest.
 */

use Drupal\Core\Database\Database;

$connection = Database::getConnection();

// Set the schema version.
$connection->insert('key_value')
  ->fields([
    'collection' => 'system.schema',
    'name' => 'rest',
    'value' => 'i:8401;',
  ])
  ->execute();
$connection->insert('key_value')
  ->fields([
    'collection' => 'system.schema',
    'name' => 'serialization',
    'value' => 'i:8401;',
  ])
  ->execute();

// Update core.extension.
$extensions = $connection->select('config')
  ->fields('config', ['data'])
  ->condition('collection', '')
  ->condition('name', 'core.extension')
  ->execute()
  ->fetchField();
$extensions = unserialize($extensions);
$extensions['module']['rest'] = 0;
$extensions['module']['serialization'] = 0;
$extensions['module']['basic_auth'] = 0;
$connection->update('config')
  ->fields([
    'data' => serialize($extensions),
  ])
  ->condition('collection', '')
  ->condition('name', 'core.extension')
  ->execute();

// Create rest.settings.
$connection->insert('config')
  ->fields([
    'collection',
    'name',
    'data',
  ])
  ->values([
    'collection' => '',
    'name' => 'rest.settings',
    'data' => 'a:1:{s:30:"bc_entity_resource_permissions";b:0;}',
  ])
  ->execute();
+1 −5
Original line number Diff line number Diff line
@@ -16,8 +16,7 @@ class RestSettingsDeletionUpdateTest extends UpdatePathTestBase {
   */
  protected function setDatabaseDumpFiles() {
    $this->databaseDumpFiles = [
      __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.8.0.bare.standard.php.gz',
      __DIR__ . '/../../../fixtures/update/rest-module-installed.php',
      __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.8.0.filled.standard.php.gz',
    ];
  }

@@ -25,9 +24,6 @@ protected function setDatabaseDumpFiles() {
   * Ensures that update hook is run for "rest" module.
   */
  public function testUpdate() {
    // @todo Remove this in https://www.drupal.org/project/drupal/issues/3095333.
    \Drupal::entityDefinitionUpdateManager()->installEntityType(\Drupal::entityTypeManager()->getDefinition('rest_resource_config'));

    $rest_settings = $this->config('rest.settings');
    $this->assertFalse($rest_settings->isNew());