22 use PHPUnit_Framework_MockObject_MockObject as Mock;
40 private $scopeValidatorMock;
45 private $pathValidatorMock;
50 private $configSetProcessorFactoryMock;
55 private $processorMock;
72 $this->scopeValidatorMock = $this->getMockBuilder(ValidatorInterface::class)
73 ->getMockForAbstractClass();
74 $this->pathValidatorMock = $this->getMockBuilder(PathValidator::class)
75 ->disableOriginalConstructor()
77 $this->configSetProcessorFactoryMock = $this->getMockBuilder(ConfigSetProcessorFactory::class)
78 ->disableOriginalConstructor()
80 $this->processorMock = $this->getMockBuilder(ConfigSetProcessorInterface::class)
81 ->getMockForAbstractClass();
83 $this->configSetProcessorFactoryMock->expects($this->any())
85 ->willReturn($this->processorMock);
87 $this->hashMock = $this->getMockBuilder(Hash::class)
88 ->disableOriginalConstructor()
90 $this->configMock = $this->getMockBuilder(Config::class)
91 ->disableOriginalConstructor()
95 $this->scopeValidatorMock,
96 $this->pathValidatorMock,
97 $this->configSetProcessorFactoryMock,
105 $this->scopeValidatorMock->expects($this->once())
108 $this->pathValidatorMock->expects($this->once())
111 $this->configSetProcessorFactoryMock->expects($this->once())
114 ->willReturn($this->processorMock);
115 $this->processorMock->expects($this->once())
118 $this->hashMock->expects($this->once())
119 ->method(
'regenerate')
121 $this->configMock->expects($this->once())
126 $this->model->processWithLockTarget(
142 $this->expectException(ValidatorException::class);
143 $this->expectExceptionMessage(
'Some error');
144 $this->scopeValidatorMock->expects($this->once())
146 ->willThrowException($exception);
148 $this->model->processWithLockTarget(
174 $this->scopeValidatorMock->expects($this->once())
177 $this->pathValidatorMock->expects($this->once())
180 $this->configSetProcessorFactoryMock->expects($this->once())
184 $this->processorMock->expects($this->never())
186 $this->configMock->expects($this->never())
189 $this->model->processWithLockTarget(
204 $this->scopeValidatorMock->expects($this->once())
207 $this->pathValidatorMock->expects($this->once())
210 $this->configSetProcessorFactoryMock->expects($this->once())
213 ->willReturn($this->processorMock);
214 $this->processorMock->expects($this->once())
218 $this->configMock->expects($this->never())
221 $this->model->processWithLockTarget(
232 $this->scopeValidatorMock->expects($this->once())
235 $this->configSetProcessorFactoryMock->expects($this->once())
238 ->willReturn($this->processorMock);
239 $this->processorMock->expects($this->once())
242 $this->configMock->expects($this->once())
246 'Value was saved in app/etc/env.php and locked.',
247 $this->model->processWithLockTarget(
259 $this->scopeValidatorMock->expects($this->once())
262 $this->configSetProcessorFactoryMock->expects($this->once())
265 ->willReturn($this->processorMock);
266 $this->processorMock->expects($this->once())
269 $this->configMock->expects($this->once())
273 'Value was saved in app/etc/config.php and locked.',
274 $this->model->processWithLockTarget(
testProcessWithConfigurationMismatchException()
testProcessWithCouldNotSaveException()
processWithValidatorExceptionDataProvider()
testProcessWithValidatorException(LocalizedException $exception)