32 private $deploymentConfig;
42 private $filePermissions;
47 private $configOptionsList;
51 $this->collector = $this->createMock(\
Magento\
Setup\Model\ConfigOptionsListCollector::class);
53 $this->deploymentConfig = $this->createMock(\
Magento\Framework\
App\DeploymentConfig::class);
54 $this->configOptionsList = $this->createMock(\
Magento\Backend\
Setup\ConfigOptionsList::class);
55 $this->configData = $this->createMock(\
Magento\Framework\
Config\
Data\ConfigData::class);
56 $this->filePermissions = $this->createMock(\
Magento\Framework\
Setup\FilePermissions::class);
58 $this->deploymentConfig->expects($this->any())->method(
'get');
63 $this->deploymentConfig,
64 $this->filePermissions
71 $option->expects($this->exactly(3))->method(
'getName')->willReturn(
'Fake');
77 $configOption = $this->configOptionsList;
78 $configOption->expects($this->once())->method(
'getOptions')->will($this->returnValue($optionsSet));
79 $configOption->expects($this->once())->method(
'validate')->will($this->returnValue([]));
82 ->expects($this->exactly(2))
83 ->method(
'collectOptionsLists')
84 ->will($this->returnValue([$configOption]));
86 $this->configModel->validate([
'Fake' =>
null]);
108 $testSetExpected1 = [
111 'someKey' =>
'value',
117 $testSetExpected2 = [
125 $configData1 = clone $this->configData;
126 $configData2 = clone $this->configData;
128 $configData1->expects($this->any())
132 $configData1->expects($this->once())->method(
'isOverrideWhenSave')->willReturn(
false);
134 $configData2->expects($this->any())
138 $configData2->expects($this->once())->method(
'isOverrideWhenSave')->willReturn(
false);
140 $configOption = $this->configOptionsList;
141 $configOption->expects($this->once())
142 ->method(
'createConfig')
143 ->will($this->returnValue([$configData1, $configData2]));
145 $configOptionsList = [
146 'Fake_Module' => $configOption
148 $this->collector->expects($this->once())
149 ->method(
'collectOptionsLists')
150 ->will($this->returnValue($configOptionsList));
152 $this->writer->expects($this->at(0))->method(
'saveConfig')->with($testSetExpected1);
153 $this->writer->expects($this->at(1))->method(
'saveConfig')->with($testSetExpected2);
155 $this->configModel->process([]);
164 $configOption = $this->configOptionsList;
165 $configOption->expects($this->once())
166 ->method(
'createConfig')
167 ->will($this->returnValue([
null]));
170 'Fake_Module' => $configOption
173 $this->collector->expects($this->once())->method(
'collectOptionsLists')->will($this->returnValue($wrongData));
175 $this->configModel->process([]);
184 $this->filePermissions->expects($this->once())->method(
'getMissingWritablePathsForInstallation')
185 ->willReturn([
'/a/ro/dir',
'/media']);
186 $this->configModel->process([]);
testWritePermissionErrors()