public function SplitFilterTest::testConditionallySplitInCompleteSplit in Configuration Split 8
Test that conditionally split config will not be completely split.
File
- src/
Tests/ SplitFilterTest.php, line 87
Class
- SplitFilterTest
- Test filter plugin.
Namespace
Drupal\config_split\TestsCode
public function testConditionallySplitInCompleteSplit() {
$configuration = [];
$configuration['blacklist'] = [
'b',
'c',
'd',
];
$configuration['graylist'] = [
'a',
];
$configuration['module'] = [];
$configuration['theme'] = [];
$configuration['graylist_dependents'] = TRUE;
// The config manager returns dependent entities for modules and themes.
$manager = $this
->prophesize('Drupal\\Core\\Config\\ConfigManagerInterface');
$manager
->findConfigEntityDependents(Argument::exact('module'), Argument::cetera())
->willReturn([]);
$manager
->findConfigEntityDependents(Argument::exact('theme'), Argument::cetera())
->willReturn([]);
// Add a config storage returning some settings for the filtered modules.
$all_config = array_merge(array_fill_keys(range("a", "z"), []), [
'module1.settings' => [],
'module3.settings' => [],
]);
$manager
->getConfigFactory()
->willReturn($this
->getConfigStorageStub($all_config));
// Add more config dependencies, independently of what is asked for.
$manager
->findConfigEntityDependents(Argument::exact('config'), Argument::exact([
'b',
'c',
'd',
]))
->willReturn([
'e' => 0,
]);
$manager
->findConfigEntityDependents(Argument::exact('config'), Argument::exact([
'a',
]))
->willReturn([
'f' => 0,
'b' => 0,
]);
$filter = new SplitFilter($configuration, 'config_split', [], $manager
->reveal());
$actual = $filter
->getBlacklist();
// The order of values and keys are not important.
sort($actual);
$this
->assertArrayEquals([
'c',
'd',
'e',
], $actual);
}