InstallStorage example

// Ensure that dependencies can be added during module installation by     // hooks.     $this->assertSame('config_install_dependency_test', $entity->getDependencies()['module'][0]);
  }

  /** * Tests imported configuration entities with/without language information. */
  public function testLanguage() {
    $this->installModules(['config_test_language']);
    // Test imported configuration with implicit language code.     $storage = new InstallStorage();
    $data = $storage->read('config_test.dynamic.dotted.english');
    $this->assertTrue(!isset($data['langcode']));
    $this->assertEquals('en', $this->config('config_test.dynamic.dotted.english')->get('langcode'));

    // Test imported configuration with explicit language code.     $data = $storage->read('config_test.dynamic.dotted.french');
    $this->assertEquals('fr', $data['langcode']);
    $this->assertEquals('fr', $this->config('config_test.dynamic.dotted.french')->get('langcode'));
  }

  /** * Tests installing configuration where the filename and ID do not match. */
    $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();
    $system_theme['default'] = 'olivero';
    $sync->write('system.theme', $system_theme);

    // Read the automated_cron config from module default config folder.     $settings = $install_storage->read('automated_cron.settings');
    $settings['interval'] = 10000;
    $sync->write('automated_cron.settings', $settings);

    
Home | Imprint | This part of the site doesn't use cookies.