X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fconfig%2Ftests%2Fsrc%2FKernel%2FConfigUninstallViaCliImportTest.php;fp=web%2Fcore%2Fmodules%2Fconfig%2Ftests%2Fsrc%2FKernel%2FConfigUninstallViaCliImportTest.php;h=722546fe303b3f67d2d2f87ebc8bfeed712fa9a1;hp=0000000000000000000000000000000000000000;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/web/core/modules/config/tests/src/Kernel/ConfigUninstallViaCliImportTest.php b/web/core/modules/config/tests/src/Kernel/ConfigUninstallViaCliImportTest.php new file mode 100644 index 000000000..722546fe3 --- /dev/null +++ b/web/core/modules/config/tests/src/Kernel/ConfigUninstallViaCliImportTest.php @@ -0,0 +1,72 @@ +markTestSkipped('This test has to be run from the CLI'); + } + + $this->installConfig(['system']); + $this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.sync')); + + // Set up the ConfigImporter object for testing. + $storage_comparer = new StorageComparer( + $this->container->get('config.storage.sync'), + $this->container->get('config.storage'), + $this->container->get('config.manager') + ); + $this->configImporter = new ConfigImporter( + $storage_comparer->createChangelist(), + $this->container->get('event_dispatcher'), + $this->container->get('config.manager'), + $this->container->get('lock'), + $this->container->get('config.typed'), + $this->container->get('module_handler'), + $this->container->get('module_installer'), + $this->container->get('theme_handler'), + $this->container->get('string_translation') + ); + } + + /** + * Tests that the config module can be uninstalled via CLI config import. + * + * @see \Drupal\config\ConfigSubscriber + */ + public function testConfigUninstallViaCli() { + $this->assertTrue($this->container->get('module_handler')->moduleExists('config')); + $sync = $this->container->get('config.storage.sync'); + $extensions = $sync->read('core.extension'); + unset($extensions['module']['config']); + $sync->write('core.extension', $extensions); + $this->configImporter->reset()->import(); + $this->assertFalse($this->container->get('module_handler')->moduleExists('config')); + } + +}