protected function IndividualExportImportTest::setUp in Configuration Split 2.0.x
Same name and namespace in other branches
- 8 tests/src/Kernel/IndividualExportImportTest.php \Drupal\Tests\config_split\Kernel\IndividualExportImportTest::setUp()
Overrides KernelTestBase::setUp
File
- tests/
src/ Kernel/ IndividualExportImportTest.php, line 62
Class
- IndividualExportImportTest
- Test the export and import of individual splits.
Namespace
Drupal\Tests\config_split\KernelCode
protected function setUp() : void {
parent::setUp();
// Make sure there is a good amount of config to play with.
$this
->installEntitySchema('user');
$this
->installEntitySchema('node');
$this
->installConfig([
'system',
'field',
'config_test',
]);
// Set up multilingual.
ConfigurableLanguage::createFromLangcode('fr')
->save();
ConfigurableLanguage::createFromLangcode('de')
->save();
// Sort the extensions, kernel tests don't concern themselves with that.
// But we care because the config importer would see a difference when we
// sort the extensions in the split.
$extension = $this->container
->get('config.storage')
->read('core.extension');
$extension['module'] = module_config_sort($extension['module']);
$this->container
->get('config.storage')
->write('core.extension', $extension);
// The split we test with.
$this->split = $this
->createSplitConfig($this
->randomMachineName(), [
'module' => [
'config_test' => 0,
],
]);
// The stand-in for \Symfony\Component\Console\Style\StyleInterface.
$this->io = new class {
/**
* The log of the method calls.
*
* @var array
*/
public $calls;
/**
* {@inheritdoc}
*/
public function __call($name, $arguments) {
$this->calls[] = [
$name => $arguments,
];
return TRUE;
}
};
// By default no translations.
$this->t = static function (string $s, $args = []) : string {
return strtr($s, $args);
};
}