public function testExecute()
 {
     $this->dialog->expects($this->at(0))->method('askAndValidate')->will($this->returnValue('*****@*****.**'));
     $this->dialog->expects($this->at(1))->method('ask')->will($this->returnValue('A name'));
     $this->dialog->expects($this->at(2))->method('askHiddenResponse')->will($this->returnValue('foobar123'));
     $commandTester = $this->getCommandTester();
     $commandTester->execute([]);
     $this->assertEquals('User account created!' . PHP_EOL, $commandTester->getDisplay());
 }
 /**
  * Test quietness
  *
  * @dataProvider dataQuietness
  */
 public function testQuietness($quiet, $noInteraction, $confirmation, $countWriteln, $countDescriber, $countClient, $countExecute)
 {
     $this->input->expects($this->any())->method('getOption')->will($this->returnValueMap(array(array('quiet', $quiet), array('no-interaction', $noInteraction))));
     $this->dialogHelper->expects($this->any())->method('askConfirmation')->will($this->returnValue($confirmation));
     $this->output->expects($countWriteln)->method('writeln');
     $this->gearmanDescriber->expects($countDescriber)->method('describeWorker');
     $this->gearmanClient->expects($countClient)->method('getWorker')->will($this->returnValue(array()));
     $this->gearmanExecute->expects($countExecute)->method('executeWorker');
     $this->command->setGearmanClient($this->gearmanClient)->setGearmanDescriber($this->gearmanDescriber)->setGearmanExecute($this->gearmanExecute)->setKernel($this->kernel)->run($this->input, $this->output);
 }
Esempio n. 3
0
 /**
  * @test
  */
 function it_can_ask_a_question_and_return_the_result()
 {
     $this->dialogHelper->expects($this->once())->method('askConfirmation')->with($this->identicalTo($this->output), 'Are you sure?', true)->willReturn(true);
     $result = $this->prompter->askConfirmation('Are you sure?');
     $this->assertEquals(true, $result);
 }
 /**
  * Ads answers to the last questions
  *
  * @param DialogHelper $dialog
  * @param int          $startAt at what position do we expect the first question
  */
 protected function addFinishingExpects(DialogHelper $dialog, &$startAt)
 {
     //Do you want to install the QA tools for Javascript? [Y/n]
     $dialog->expects($this->at($startAt++))->method('askConfirmation')->with($this->anything(), $this->equalTo("\nDo you want to install the QA tools for Javascript?"))->will($this->returnValue(true));
     $dialog->expects($this->at($startAt++))->method('askConfirmation')->with($this->anything(), $this->equalTo('Do you want to enable JSHint?'))->will($this->returnValue(false));
     $dialog->expects($this->at($startAt++))->method('askConfirmation')->with($this->anything(), $this->equalTo("\nDo you want to install the Behat framework?"))->will($this->returnValue(true));
     $dialog->expects($this->at($startAt++))->method('askAndValidate')->with($this->anything(), $this->equalTo("What is base url of your application? [http://www.ibuildings.nl] "))->will($this->returnValue('http://test'));
     $dialog->expects($this->at($startAt++))->method('askAndValidate')->with($this->anything(), $this->equalTo("What is base url of the ci environment? [http://ci.test] "))->will($this->returnValue('http://ci.test'));
     $dialog->expects($this->at($startAt++))->method('askAndValidate')->with($this->anything(), $this->equalTo("What is base url of the dev environment? [http://dev.test] "))->will($this->returnValue('http://dev.test'));
     $dialog->expects($this->at($startAt++))->method('askConfirmation')->with($this->anything(), $this->equalTo("\nDo you want to enable the git pre-commit hook? It will run the QA tools on every commit"))->will($this->returnValue(true));
 }