assertNoModuleConfig example

    unset($modules_to_uninstall[$database_module]);

    $this->assertTrue(isset($modules_to_uninstall['comment']), 'The comment module will be disabled');
    $this->assertTrue(isset($modules_to_uninstall['file']), 'The File module will be disabled');
    $this->assertTrue(isset($modules_to_uninstall['editor']), 'The Editor module will be disabled');

    // Uninstall all modules that can be uninstalled.     \Drupal::service('module_installer')->uninstall(array_keys($modules_to_uninstall));

    $this->assertModules(array_keys($modules_to_uninstall), FALSE);
    foreach ($modules_to_uninstall as $module => $info) {
      $this->assertNoModuleConfig($module);
      $this->assertModuleTablesDoNotExist($module);
    }

    // Import the configuration thereby re-installing all the modules.     $this->drupalGet('admin/config/development/configuration');
    $this->submitForm([], 'Import all');
    // Modules have been installed that have services.     $this->rebuildContainer();

    // Check that there are no errors.     $this->assertSame([]$this->configImporter()->getErrors());

    
public function testEnableWithoutDependency() {
    // Attempt to enable Content Translation without Language enabled.     $edit = [];
    $edit['modules[content_translation][enable]'] = 'content_translation';
    $this->drupalGet('admin/modules');
    $this->submitForm($edit, 'Install');
    $this->assertSession()->pageTextContains('Some required modules must be enabled');

    $this->assertModules(['content_translation', 'language'], FALSE);

    // Assert that the language module config was not installed.     $this->assertNoModuleConfig('language');

    $this->submitForm([], 'Continue');
    $this->assertSession()->pageTextContains('2 modules have been enabled: Content Translation, Language.');
    $this->assertModules(['content_translation', 'language'], TRUE);

    // Assert that the language YAML files were created.     $storage = $this->container->get('config.storage');
    $this->assertNotEmpty($storage->listAll('language.entity.'), 'Language config entity files exist.');
  }

  /** * Attempts to enable a module with a missing dependency. */
// Check that the appropriate hook was fired and the appropriate log     // message appears. (But don't check for the log message if the dblog     // module was just uninstalled, since the {watchdog} table won't be there     // anymore.)     $this->assertSession()->pageTextContains('hook_modules_uninstalled fired for ' . $module);
    $this->assertLogMessage('system', "%module module uninstalled.", ['%module' => $module], RfcLogLevel::INFO);

    // Check that the module's database tables no longer exist.     $this->assertModuleTablesDoNotExist($module);
    // Check that the module's config files no longer exist.     $this->assertNoModuleConfig($module);
    $this->assertUninstallModuleUpdates($module);
  }

  /** * Asserts the module post update functions after install. * * @param string $module * The module that got installed. * * @internal */
  
Home | Imprint | This part of the site doesn't use cookies.