public function testRun() { $app = $this->getApp(); $command = new LogClear($app); $dialog = new DialogHelper(); $dialog->setInputStream($this->getInputStream("Yes\n")); $command->setHelperSet(new HelperSet(array($dialog))); $tester = new CommandTester($command); $tester->execute(array()); $result = $tester->getDisplay(); $this->assertRegexp('/System & change logs cleared/', $result); }
public function testRun() { $app = $this->getApp(); $command = new LogClear($app); $tester = new CommandTester($command); $helper = $this->getMockBuilder(QuestionHelper::class)->setMethods(['ask'])->getMock(); $helper->expects($this->once())->method('ask')->will($this->returnValue(true)); $set = new HelperSet(['question' => $helper]); $command->setHelperSet($set); $tester->execute([]); $result = $tester->getDisplay(); $this->assertRegExp('/System & change logs cleared/', $result); }