本文整理汇总了PHP中Symfony\Component\Console\Helper\DialogHelper::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP DialogHelper::expects方法的具体用法?PHP DialogHelper::expects怎么用?PHP DialogHelper::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Console\Helper\DialogHelper
的用法示例。
在下文中一共展示了DialogHelper::expects方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testExecute
public function testExecute()
{
$this->dialog->expects($this->at(0))->method('askAndValidate')->will($this->returnValue('test@example.com'));
$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());
}
示例2: testQuietness
/**
* 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);
}
示例3:
/**
* @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);
}
示例4: addFinishingExpects
/**
* 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));
}