18 use PHPUnit_Framework_MockObject_MockObject as Mock;
36 private $preparedValueFactory;
41 private $deploymentConfigWriterMock;
46 private $arrayManagerMock;
51 private $configPathResolver;
63 $this->preparedValueFactory = $this->getMockBuilder(PreparedValueFactory::class)
64 ->disableOriginalConstructor()
66 $this->deploymentConfigWriterMock = $this->getMockBuilder(
DeploymentConfig\Writer::class)
67 ->disableOriginalConstructor()
69 $this->arrayManagerMock = $this->getMockBuilder(ArrayManager::class)
70 ->disableOriginalConstructor()
72 $this->configPathResolver = $this->getMockBuilder(ConfigPathResolver::class)
73 ->disableOriginalConstructor()
75 $this->valueMock = $this->getMockBuilder(Value::class)
76 ->setMethods([
'validateBeforeSave',
'beforeSave',
'setValue',
'getValue',
'afterSave'])
77 ->disableOriginalConstructor()
81 $this->preparedValueFactory,
82 $this->deploymentConfigWriterMock,
83 $this->arrayManagerMock,
84 $this->configPathResolver,
100 $this->preparedValueFactory->expects($this->once())
103 ->willReturn($this->valueMock);
104 $this->configPathResolver->expects($this->once())
106 ->willReturn(
'system/default/test/test/test');
107 $this->arrayManagerMock->expects($this->once())
109 ->with(
'system/default/test/test/test', [],
$value)
121 $this->valueMock->expects($this->once())
124 $this->deploymentConfigWriterMock->expects($this->once())
125 ->method(
'saveConfig')
142 $this->valueMock->expects($this->once())
143 ->method(
'validateBeforeSave');
144 $this->valueMock->expects($this->once())
145 ->method(
'beforeSave');
146 $this->valueMock->expects($this->once())
147 ->method(
'afterSave');
149 $this->model->process(
$path,
$value, $scope, $scopeCode);
170 $path =
'test/test/test';
173 $this->preparedValueFactory->expects($this->once())
175 ->willReturn($this->valueMock);
176 $this->valueMock->expects($this->once())
179 $this->configPathResolver->expects($this->once())
181 ->willReturn(
'system/default/test/test/test');
182 $this->arrayManagerMock->expects($this->once())
184 ->with(
'system/default/test/test/test', [],
$value)
186 $this->deploymentConfigWriterMock->expects($this->once())
187 ->method(
'saveConfig')
199 $path =
'test/test/test';
202 $this->configPathResolver->expects($this->once())
204 ->willReturn(
'system/default/test/test/test');
205 $this->preparedValueFactory->expects($this->once())
207 ->willReturn($this->valueMock);
208 $this->arrayManagerMock->expects($this->never())
210 $this->valueMock->expects($this->once())
211 ->method(
'getValue');
212 $this->valueMock->expects($this->once())
213 ->method(
'afterSave')
214 ->willThrowException(
new \Exception(
'Invalid values'));
215 $this->deploymentConfigWriterMock->expects($this->never())
216 ->method(
'saveConfig');
testProcessNotReadableFs()
testProcess($path, $value, $scope, $scopeCode)