module_config_sort example


      $archiver->extractList($files$config_sync_directory);
    }

    // Add the module that is providing the database driver to the list of     // modules that can not be uninstalled in the core.extension configuration.     if (file_exists($config_sync_directory . '/core.extension.yml')) {
      $core_extension = Yaml::decode(file_get_contents($config_sync_directory . '/core.extension.yml'));
      $module = Database::getConnection()->getProvider();
      if ($module !== 'core') {
        $core_extension['module'][$module] = 0;
        $core_extension['module'] = module_config_sort($core_extension['module']);
        file_put_contents($config_sync_directory . '/core.extension.yml', Yaml::encode($core_extension));
      }
    }
  }

  /** * Gets the filepath to the configuration tarball. * * The tarball will be extracted to the install profile's config/sync * directory for testing. * * @return string * The filepath to the configuration tarball. */
        // in hook_install() are not reflected in $extension_config.         $extension_config = \Drupal::configFactory()->getEditable('core.extension');

        // Check the validity of the default configuration. This will throw         // exceptions if the configuration is not valid.         $config_installer->checkConfigurationToInstall('module', $module);

        // Save this data without checking schema. This is a performance         // improvement for module installation.         $extension_config
          ->set("module.$module", 0)
          ->set('module', module_config_sort($extension_config->get('module')))
          ->save(TRUE);

        // Prepare the new module list, sorted by weight, including filenames.         // This list is used for both the ModuleHandler and DrupalKernel. It         // needs to be kept in sync between both. A DrupalKernel reboot or         // rebuild will automatically re-instantiate a new ModuleHandler that         // uses the new module list of the kernel. However, DrupalKernel does         // not cause any modules to be loaded.         // Furthermore, the currently active (fixed) module list can be         // different from the configured list of enabled modules. For all active         // modules not contained in the configured enabled modules, we assume a
$existing = $this->activeStorage->read('core.extension');

    $modules = $extension['module'];
    foreach ($this->getExcludedModules() as $module) {
      if (array_key_exists($module$existing['module'])) {
        // Set the modules weight from the active store.         $modules[$module] = $existing['module'][$module];
      }
    }

    // Sort the extensions.     $extension['module'] = module_config_sort($modules);
    // Set the modified extension.     $storage->write('core.extension', $extension);
  }

  /** * Transform the storage which is used to export the configuration. * * Make sure excluded modules are not exported by removing all the config * which depends on them from the storage that is exported. * * @param \Drupal\Core\Config\StorageTransformEvent $event * The transformation event. */
/** * Tests that a module can add services that depend on new modules. */
  public function testUpdateNewDependency() {
    // The new_dependency_test before the update is just an empty info.yml file.     // The code of the new_dependency_test module is after the update and     // contains the dependency on the new_dependency_test_with_service module.     $extension_config = $this->container->get('config.factory')->getEditable('core.extension');
    $extension_config
      ->set('module.new_dependency_test', 0)
      ->set('module', module_config_sort($extension_config->get('module')))
      ->save(TRUE);
    \Drupal::service('update.update_hook_registry')->setInstalledVersion('new_dependency_test', \Drupal::CORE_MINIMUM_SCHEMA_VERSION);

    // Rebuild the container and test that the service with the optional unmet     // dependency is still available while the ones that fail are not.     try {
      $this->rebuildContainer();
      $this->fail('The container has services with unmet dependencies and should have failed to rebuild.');
    }
    catch (ServiceNotFoundException $exception) {
      $this->assertStringContainsString('The service "new_dependency_test.dependent" has a dependency on a non-existent service "new_dependency_test_with_service.service".', $exception->getMessage());
    }
$this->drupalGet(Url::fromUri('base:core/rebuild.php'));
    $this->assertSession()->addressEquals(new Url('<front>'));
    $this->refreshVariables();
    $this->assertSame(1, \Drupal::state()->get('container_rebuild_test.count', 0));
    $this->drupalGet('/container_rebuild_test/module_test/module_test_system_info_alter');
    $this->assertSession()->pageTextContains('module_test: not installed');
    $this->assertSession()->pageTextContains('module_test_system_info_alter: false');

    // Enable a module by writing to the core.extension list.     $modules = $this->config('core.extension')->get('module');
    $modules['module_test'] = 0;
    $this->config('core.extension')->set('module', module_config_sort($modules))->save();
    \Drupal::state()->set('container_rebuild_test.count', 0);
    $this->drupalGet(Url::fromUri('base:core/rebuild.php'));
    $this->assertSession()->addressEquals(new Url('<front>'));
    $this->refreshVariables();
    $this->assertSame(1, \Drupal::state()->get('container_rebuild_test.count', 0));
    $this->drupalGet('/container_rebuild_test/module_test/module_test_system_info_alter');
    $this->assertSession()->pageTextContains('module_test: ' . $this->siteDirectory . '/modules/module_test');
    $this->assertSession()->pageTextContains('module_test_system_info_alter: true');

    // Test how many container rebuild occur when there is no cached container.     \Drupal::state()->set('container_rebuild_test.count', 0);
    

    $sync->write($dynamic_name$original_dynamic_data);
    $this->assertTrue($sync->exists($dynamic_name)$dynamic_name . ' found.');

    // Enable the Automated Cron and Ban modules during import. The Ban     // module is used because it creates a table during the install.     // The Automated Cron module is used because it creates a single simple     // configuration file during the install.     $core_extension = $this->config('core.extension')->get();
    $core_extension['module']['automated_cron'] = 0;
    $core_extension['module']['ban'] = 0;
    $core_extension['module'] = module_config_sort($core_extension['module']);
    $core_extension['theme']['olivero'] = 0;
    $sync->write('core.extension', $core_extension);
    // Olivero ships with configuration.     $sync->write('olivero.settings', Yaml::decode(file_get_contents('core/themes/olivero/config/install/olivero.settings.yml')));

    // Use the install storage so that we can read configuration from modules     // and themes that are not installed.     $install_storage = new InstallStorage();

    // Set the Olivero theme as default.     $system_theme = $this->config('system.theme')->get();
    

  protected static $modules = ['system'];

  /** * Tests that drupal_flush_all_caches() uses core.extension properly. */
  public function testDrupalFlushAllCachesModuleList() {
    $this->assertFalse(function_exists('system_test_help'));
    $core_extension = \Drupal::configFactory()->getEditable('core.extension');
    $module = $core_extension->get('module');
    $module['system_test'] = -10;
    $core_extension->set('module', module_config_sort($module))->save();
    $this->containerBuilds = 0;
    drupal_flush_all_caches();
    $module_list = ['system_test', 'system'];
    $database_module = \Drupal::database()->getProvider();
    if ($database_module !== 'core') {
      $module_list[] = $database_module;
    }
    sort($module_list);
    $container_modules = array_keys($this->container->getParameter('container.modules'));
    sort($container_modules);
    $this->assertSame($module_list$container_modules);
    
Home | Imprint | This part of the site doesn't use cookies.