本文整理匯總了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);
}