当前位置: 首页>>代码示例>>PHP>>正文


PHP InputInterface::shouldReceive方法代码示例

本文整理汇总了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);
 }
开发者ID:silktide,项目名称:teamster,代码行数:10,代码来源:ThreadCommandTest.php

示例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();
 }
开发者ID:silktide,项目名称:teamster,代码行数:13,代码来源:PoolCommandTest.php

示例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);
 }
开发者ID:silktide,项目名称:teamster,代码行数:23,代码来源:PoolControlCommandTest.php

示例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);
 }
开发者ID:bbonnesoeur,项目名称:phpDocumentor2,代码行数:13,代码来源:ConfigurationHelperTest.php


注:本文中的Symfony\Component\Console\Input\InputInterface::shouldReceive方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。