當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ObjectProphecy::getOutput方法代碼示例

本文整理匯總了PHP中Prophecy\Prophecy\ObjectProphecy::getOutput方法的典型用法代碼示例。如果您正苦於以下問題:PHP ObjectProphecy::getOutput方法的具體用法?PHP ObjectProphecy::getOutput怎麽用?PHP ObjectProphecy::getOutput使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Prophecy\Prophecy\ObjectProphecy的用法示例。


在下文中一共展示了ObjectProphecy::getOutput方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _expectCommand

 /**
  * Sets expectation for specific command.
  *
  * @param string $command Command.
  * @param string $output  Output.
  *
  * @return void
  */
 private function _expectCommand($command, $output)
 {
     $this->_process->getCommandLine()->willReturn($command)->shouldBeCalled();
     $this->_process->mustRun(null)->shouldBeCalled();
     $this->_process->getOutput()->willReturn($output)->shouldBeCalled();
     $this->_processFactory->createProcess($command, 1200)->willReturn($this->_process)->shouldBeCalled();
 }
開發者ID:aik099,項目名稱:svn-buddy,代碼行數:15,代碼來源:ConnectorTest.php

示例2: testRunError

    public function testRunError()
    {
        $this->_process->getCommandLine()->willReturn('svn log')->shouldBeCalled();
        $process = $this->_process;
        $this->_process->mustRun(null)->will(function () use($process) {
            $mock_definition = array('isSuccessful' => false, 'getExitCode' => 1, 'getExitCodeText' => 'exit code text', 'isOutputDisabled' => false, 'getOutput' => 'normal output', 'getErrorOutput' => 'error output');
            foreach ($mock_definition as $method_name => $return_value) {
                $process->{$method_name}()->willReturn($return_value)->shouldBeCalled();
            }
            throw new ProcessFailedException($process->reveal());
        })->shouldBeCalled();
        $this->_process->getOutput()->shouldNotBeCalled();
        $this->_io->isVerbose()->shouldNotBeCalled();
        $this->_io->isDebug()->shouldNotBeCalled();
        $this->_cacheManager->getCache(Argument::any())->shouldNotBeCalled();
        $thrown_exception = null;
        try {
            $this->_command->run();
        } catch (\Exception $thrown_exception) {
            $this->assertEquals('ConsoleHelpers\\SVNBuddy\\Exception\\RepositoryCommandException', get_class($thrown_exception), 'Exception of correct class was thrown');
        }
        $this->assertNotNull($thrown_exception, 'Exception was thrown when command execution failed');
        $error_msg = <<<MSG
Command:
svn log
Error #0:
error output
MSG;
        $this->assertEquals($error_msg, $thrown_exception->getMessage());
    }
開發者ID:aik099,項目名稱:svn-buddy,代碼行數:30,代碼來源:CommandTest.php


注:本文中的Prophecy\Prophecy\ObjectProphecy::getOutput方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。