当前位置: 首页>>代码示例>>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;未经允许,请勿转载。