3 namespace Drupal\Tests\system\Functional\Update;
5 use Drupal\FunctionalTests\Update\UpdatePathTestBase;
8 * Tests system_update_8200().
10 * @see system_update_8200()
15 class ConfigOverridesUpdateTest extends UpdatePathTestBase {
20 protected function setDatabaseDumpFiles() {
21 $this->databaseDumpFiles = [
22 __DIR__ . '/../../../../tests/fixtures/update/drupal-8.filled.standard.php.gz',
23 __DIR__ . '/../../../../tests/fixtures/update/drupal-8.config-override-fix.php',
28 * Tests that configuration has been updated.
30 public function testUpdatedSite() {
31 $key_to_be_removed = 'display.default.display_options.fields.nid';
32 /** @var \Drupal\Core\Config\Config $config_override */
33 $language_config_override = \Drupal::service('language.config_factory_override');
34 $config_override = $language_config_override->getOverride('es', 'views.view.content');
35 $this->assertEqual('Spanish ID', $config_override->get($key_to_be_removed)['label'], 'The spanish override for the missing field exists before updating.');
36 // Since the above view will be fixed by other updates that fix views
37 // configuration for example,
38 // views_post_update_update_cacheability_metadata(), also test configuration
39 // that has yet to be modified in an update path.
40 $config_override = $language_config_override->getOverride('es', 'system.cron');
41 $this->assertEqual('Should be cleaned by system_update_8200', $config_override->get('bogus_key'), 'The spanish override in system.cron exists before updating.');
45 /** @var \Drupal\Core\Config\Config $config_override */
46 $config_override = \Drupal::service('language.config_factory_override')->getOverride('es', 'views.view.content');
47 $this->assertNull($config_override->get($key_to_be_removed), 'The spanish override for the missing field has been removed.');
48 $config_override = $language_config_override->getOverride('es', 'system.cron');
49 $this->assertTrue($config_override->isNew(), 'After updating the system.cron spanish override does not exist.');
50 $this->assertTrue(empty($config_override->get()), 'After updating the system.cron spanish override has no data.');
52 // Test that the spanish overrides still work.
53 $this->drupalLogin($this->createUser(['access content overview']));
54 $this->drupalGet('admin/content', ['language' => \Drupal::languageManager()->getLanguage('es')]);
55 $this->assertText('Spanish Title');
56 $this->assertText('Spanish Author');