11 use Symfony\Component\Console\Tester\CommandTester;
19 private $installerFactory;
33 $this->installerFactory = $this->createMock(\
Magento\Setup\Model\InstallerFactory::class);
34 $this->installer = $this->createMock(\
Magento\Setup\Model\Installer::class);
40 $this->installer->expects($this->once())->method(
'uninstall');
41 $this->installerFactory->expects($this->once())->method(
'create')->will($this->returnValue($this->installer));
43 $this->checkInteraction(
true);
48 $this->installer->expects($this->exactly(0))->method(
'uninstall');
49 $this->installerFactory->expects($this->exactly(0))->method(
'create');
51 $this->checkInteraction(
false);
57 public function checkInteraction($answer)
59 $question = $this->createMock(\Symfony\Component\Console\Helper\QuestionHelper::class);
61 ->expects($this->once())
63 ->will($this->returnValue($answer));
66 $helperSet = $this->createMock(\Symfony\Component\Console\Helper\HelperSet::class);
68 ->expects($this->once())
71 ->will($this->returnValue($question));
72 $this->command->setHelperSet($helperSet);
74 $tester =
new CommandTester($this->command);
testExecuteInteractionYes()
testExecuteInteractionNo()