askConfirmation() public method

public askConfirmation ( $question, $default = true )
Ejemplo n.º 1
0
 public function testAskConfirmation()
 {
     $inputMock = $this->getMockBuilder('Symfony\\Component\\Console\\Input\\InputInterface')->getMock();
     $outputMock = $this->getMockBuilder('Symfony\\Component\\Console\\Output\\OutputInterface')->getMock();
     $questionHelperMock = $this->getMockBuilder('Symfony\\Component\\Console\\Helper\\QuestionHelper')->getMock();
     $helperMock = $this->getMockBuilder('Symfony\\Component\\Console\\Helper\\HelperSet')->getMock();
     $question = new \Symfony\Component\Console\Question\ConfirmationQuestion('Is valid?', true);
     $questionHelperMock->expects($this->once())->method('ask')->with($this->isInstanceOf('Symfony\\Component\\Console\\Input\\InputInterface'), $this->isInstanceOf('Symfony\\Component\\Console\\Output\\OutputInterface'), $question);
     $helperMock->expects($this->once())->method('get')->with($this->equalTo('question'))->will($this->returnValue($questionHelperMock));
     $consoleIO = new ConsoleIO($inputMock, $outputMock, $helperMock);
     $consoleIO->askConfirmation('Is valid?', true);
 }
Ejemplo n.º 2
0
 public function testAskConfirmation()
 {
     $inputMock = $this->getMock('Symfony\\Component\\Console\\Input\\InputInterface');
     $outputMock = $this->getMock('Symfony\\Component\\Console\\Output\\OutputInterface');
     $dialogMock = $this->getMock('Symfony\\Component\\Console\\Helper\\DialogHelper');
     $helperMock = $this->getMock('Symfony\\Component\\Console\\Helper\\HelperSet');
     $dialogMock->expects($this->once())->method('askConfirmation')->with($this->isInstanceOf('Symfony\\Component\\Console\\Output\\OutputInterface'), $this->equalTo('Is valid?'), $this->equalTo('default'));
     $helperMock->expects($this->once())->method('get')->with($this->equalTo('dialog'))->will($this->returnValue($dialogMock));
     $consoleIO = new ConsoleIO($inputMock, $outputMock, $helperMock);
     $consoleIO->askConfirmation('Is valid?', 'default');
 }