20 use PHPUnit_Framework_MockObject_MockObject as MockObject;
21 use Symfony\Component\Console\Input\InputInterface;
22 use Symfony\Component\Console\Output\OutputInterface;
32 private $configFilePoolMock;
37 private $commentParserMock;
42 private $configWriterMock;
47 private $scopeValidatorMock;
52 private $collectorFactoryMock;
74 $this->configFilePoolMock = $this->getMockBuilder(ConfigFilePool::class)
75 ->disableOriginalConstructor()
77 $this->commentParserMock = $this->getMockBuilder(CommentParserInterface::class)
78 ->getMockForAbstractClass();
79 $this->configWriterMock = $this->getMockBuilder(ConfigWriter::class)
80 ->disableOriginalConstructor()
82 $this->scopeValidatorMock = $this->getMockBuilder(ValidatorInterface::class)
83 ->getMockForAbstractClass();
84 $this->collectorFactoryMock = $this->getMockBuilder(CollectorFactory::class)
85 ->disableOriginalConstructor()
87 $this->inputMock = $this->getMockBuilder(InputInterface::class)
88 ->getMockForAbstractClass();
89 $this->outputMock = $this->getMockBuilder(OutputInterface::class)
90 ->getMockForAbstractClass();
93 $this->configFilePoolMock,
94 $this->commentParserMock,
95 $this->configWriterMock,
96 $this->scopeValidatorMock,
97 $this->collectorFactoryMock
107 $this->inputMock->expects($this->any())
108 ->method(
'getOption')
113 $this->configFilePoolMock->expects($this->once())
116 ->willReturn(
'config.php');
117 $this->scopeValidatorMock->expects($this->once())
119 ->with(
'default',
'')
121 $this->commentParserMock->expects($this->any())
125 $this->command->process(
137 $exceptionMessage =
'Some exception';
138 $this->inputMock->expects($this->any())
139 ->method(
'getOption')
144 $this->scopeValidatorMock->expects($this->once())
146 ->with(
'default',
'')
148 $this->commentParserMock->expects($this->once())
154 $collectorMock = $this->getMockBuilder(CollectorInterface::class)
155 ->getMockForAbstractClass();
156 $collectorMock->expects($this->once())
157 ->method(
'getValues')
158 ->willReturn([
'some/config/pathNotExist' =>
'value']);
159 $this->collectorFactoryMock->expects($this->once())
162 ->willReturn($collectorMock);
163 $this->configWriterMock->expects($this->once())
167 $this->command->process(
179 $this->inputMock->expects($this->any())
180 ->method(
'getOption')
185 $this->scopeValidatorMock->expects($this->once())
187 ->with(
'default',
'')
189 $this->commentParserMock->expects($this->once())
193 $this->command->process(
201 $collectedValues = [
'some/config/path1' =>
'value'];
202 $this->inputMock->expects($this->any())
203 ->method(
'getOption')
208 $this->scopeValidatorMock->expects($this->once())
210 ->with(
'default',
'')
212 $this->commentParserMock->expects($this->once())
218 $collectorMock = $this->getMockBuilder(CollectorInterface::class)
219 ->getMockForAbstractClass();
220 $collectorMock->expects($this->once())
221 ->method(
'getValues')
222 ->willReturn($collectedValues);
223 $this->collectorFactoryMock->expects($this->once())
226 ->willReturn($collectorMock);
227 $this->configWriterMock->expects($this->once())
231 $this->command->process(
239 $collectedValues = [
'some/config/path1' =>
'value'];
240 $this->inputMock->expects($this->any())
241 ->method(
'getOption')
247 $this->scopeValidatorMock->expects($this->once())
249 ->with(
'default',
'')
251 $this->commentParserMock->expects($this->once())
258 $collectorMock = $this->getMockBuilder(CollectorInterface::class)
259 ->getMockForAbstractClass();
260 $collectorMock->expects($this->once())
261 ->method(
'getValues')
262 ->willReturn($collectedValues);
263 $this->collectorFactoryMock->expects($this->once())
266 ->willReturn($collectorMock);
267 $this->configWriterMock->expects($this->once())
271 $this->command->process(
const INPUT_OPTION_INTERACTIVE