annotate core/modules/system/tests/fixtures/update/drupal-8.config-override-fix.php @ 5:12f9dff5fda9
tip
Update to Drupal core 8.7.1
author |
Chris Cannam |
date |
Thu, 09 May 2019 15:34:47 +0100 |
parents |
c75dbcec494b |
children |
|
rev |
line source |
Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 /**
|
Chris@0
|
4 * @file
|
Chris@0
|
5 * Partial database to create broken config overrides.
|
Chris@0
|
6 *
|
Chris@0
|
7 * @see \Drupal\system\Tests\Update\ConfigOverridesUpdateTest
|
Chris@0
|
8 */
|
Chris@0
|
9
|
Chris@0
|
10 use Drupal\Core\Database\Database;
|
Chris@0
|
11 use Symfony\Component\Yaml\Yaml;
|
Chris@0
|
12
|
Chris@0
|
13 $connection = Database::getConnection();
|
Chris@0
|
14
|
Chris@0
|
15 // Install the incorrect override configuration.
|
Chris@0
|
16 $configs = [
|
Chris@0
|
17 // The view has field titles translated and had an addition field added,
|
Chris@0
|
18 // translated and then removed.
|
Chris@0
|
19 'views.view.content',
|
Chris@0
|
20 // The configuration has a bogus key.
|
Chris@0
|
21 'system.cron',
|
Chris@0
|
22 ];
|
Chris@0
|
23 foreach ($configs as $config_name) {
|
Chris@0
|
24 $config = Yaml::parse(file_get_contents(__DIR__ . '/es-' . $config_name . '.yml'));
|
Chris@0
|
25 $connection->delete('config')
|
Chris@0
|
26 ->condition('name', $config_name)
|
Chris@0
|
27 ->condition('collection', 'language.es')
|
Chris@0
|
28 ->execute();
|
Chris@0
|
29 $connection->insert('config')
|
Chris@0
|
30 ->fields(['data', 'name', 'collection'])
|
Chris@0
|
31 ->values([
|
Chris@0
|
32 'name' => $config_name,
|
Chris@0
|
33 'data' => serialize($config),
|
Chris@0
|
34 'collection' => 'language.es',
|
Chris@0
|
35 ])
|
Chris@0
|
36 ->execute();
|
Chris@0
|
37 }
|