本文整理汇总了PHP中Symfony\Component\Console\Input\InputInterface::shouldReceive方法的典型用法代码示例。如果您正苦于以下问题:PHP InputInterface::shouldReceive方法的具体用法?PHP InputInterface::shouldReceive怎么用?PHP InputInterface::shouldReceive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Console\Input\InputInterface
的用法示例。
在下文中一共展示了InputInterface::shouldReceive方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testExecuteCommand
public function testExecuteCommand()
{
foreach ($this->argList as $arg => $value) {
$this->input->shouldReceive("getArgument")->withArgs([$arg])->once()->andReturn($value);
}
$this->runnerFactory->shouldReceive("createRunner")->withArgs([$this->argList["type"], "", $this->argList["maxRunCount"]])->once();
$this->runner->shouldReceive("execute")->withArgs([$this->argList["threadCommand"]])->once();
$command = new ThreadCommand("thread:command", $this->runnerFactory);
$command->execute($this->input, $this->output);
}
示例2: testDestruct
public function testDestruct()
{
$instances = 3;
$serviceConfig = ["command" => ["instances" => $instances, "command" => "command", "type" => "console"]];
// set up # test runs
$this->input->shouldReceive("hasOption")->andReturn(true);
$this->input->shouldReceive("getOption")->andReturn($instances);
// run the command
$command = new PoolCommand("pool:command", "thread:command", "pool.pid", $this->pidFactory, $this->runnerFactory, $serviceConfig, 50000);
$command->execute($this->input, $this->output);
$this->runner->shouldReceive("finish")->times(3);
$command->__destruct();
}
示例3: testRestart
public function testRestart()
{
$poolCommand = "pool:command";
// running two tests, both should execute the command
$this->runner->shouldReceive("execute")->withArgs([$poolCommand, false])->twice();
$this->input->shouldReceive("getArgument")->andReturn("restart");
// test when pool is running
// setup process to kill
$timeout = 50000;
$pidFilePath = "test.pid";
$startTime = $this->startChildProcess($timeout, $pidFilePath);
// create command
$command = new PoolControlCommand($this->runnerFactory, $this->pidFactory, $this->getPath($pidFilePath), $poolCommand);
// run the stop command
$command->execute($this->input, $this->output);
// check the timing. duration should be less than the process timeout
$duration = microtime(true) - $startTime;
$timeout /= 1000000;
$this->assertLessThan($timeout, $duration, "duration, {$duration}, was greater than timeout, {$timeout}");
// test when pool is stopped
vfsStreamWrapper::getRoot()->removeChild($pidFilePath);
$command->execute($this->input, $this->output);
}
示例4: whenAnOptionIsRetrievedFromInput
/**
* Makes sure the getOption method of the input returns the expected value when a specific name is requested.
*
* @param m\MockInterface|InputInterface $inputMock
* @param string $optionName
* @param mixed $expected
*
* @return void
*/
private function whenAnOptionIsRetrievedFromInput($inputMock, $optionName, $expected)
{
$inputMock->shouldReceive('getOption')->with($optionName)->andReturn($expected);
}