當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。