Mercurial > hg > cmmr2012-drupal-site
diff core/modules/system/tests/fixtures/update/drupal-8.config-override-fix.php @ 0:c75dbcec494b
Initial commit from drush-created site
author | Chris Cannam |
---|---|
date | Thu, 05 Jul 2018 14:24:15 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/modules/system/tests/fixtures/update/drupal-8.config-override-fix.php Thu Jul 05 14:24:15 2018 +0000 @@ -0,0 +1,37 @@ +<?php + +/** + * @file + * Partial database to create broken config overrides. + * + * @see \Drupal\system\Tests\Update\ConfigOverridesUpdateTest + */ + +use Drupal\Core\Database\Database; +use Symfony\Component\Yaml\Yaml; + +$connection = Database::getConnection(); + +// Install the incorrect override configuration. +$configs = [ + // The view has field titles translated and had an addition field added, + // translated and then removed. + 'views.view.content', + // The configuration has a bogus key. + 'system.cron', +]; +foreach ($configs as $config_name) { + $config = Yaml::parse(file_get_contents(__DIR__ . '/es-' . $config_name . '.yml')); + $connection->delete('config') + ->condition('name', $config_name) + ->condition('collection', 'language.es') + ->execute(); + $connection->insert('config') + ->fields(['data', 'name', 'collection']) + ->values([ + 'name' => $config_name, + 'data' => serialize($config), + 'collection' => 'language.es', + ]) + ->execute(); +}