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


PHP ObjectProphecy::isVerbose方法代码示例

本文整理汇总了PHP中Prophecy\Prophecy\ObjectProphecy::isVerbose方法的典型用法代码示例。如果您正苦于以下问题:PHP ObjectProphecy::isVerbose方法的具体用法?PHP ObjectProphecy::isVerbose怎么用?PHP ObjectProphecy::isVerbose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Prophecy\Prophecy\ObjectProphecy的用法示例。


在下文中一共展示了ObjectProphecy::isVerbose方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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

示例2: testRefreshWithoutCacheWithOutput

 /**
  * @dataProvider refreshWithoutCacheWithOutputDataProvider
  */
 public function testRefreshWithoutCacheWithOutput($is_verbose)
 {
     // Create progress bar for repository.
     $repository_progress_bar = $this->prophesize('Symfony\\Component\\Console\\Helper\\ProgressBar');
     $repository_progress_bar->setMessage(' * Reading missing revisions:')->shouldBeCalled();
     $repository_progress_bar->setFormat('%message% %current%/%max% [%bar%] <info>%percent:3s%%</info> %elapsed:6s%/%estimated:-6s% <info>%memory:-10s%</info>')->shouldBeCalled();
     $repository_progress_bar->start()->shouldBeCalled();
     $repository_progress_bar->advance()->shouldBeCalled();
     $repository_progress_bar->clear()->shouldBeCalled();
     $this->io->createProgressBar(3)->willReturn($repository_progress_bar)->shouldBeCalled();
     // Create progress bar for database.
     $database_progress_bar = $this->prophesize('Symfony\\Component\\Console\\Helper\\ProgressBar');
     $database_progress_bar->setMessage(' * Reading missing revisions:')->shouldBeCalled();
     $database_progress_bar->setFormat('%message% %current% [%bar%] %elapsed:6s% <info>%memory:-10s%</info>')->shouldBeCalled();
     $database_progress_bar->start()->shouldBeCalled();
     $database_progress_bar->advance()->shouldBeCalled();
     $database_progress_bar->finish()->shouldBeCalled();
     $this->io->createProgressBar()->willReturn($database_progress_bar)->shouldBeCalled();
     $this->io->writeln('')->shouldBeCalled();
     $this->io->isVerbose()->willReturn($is_verbose);
     if ($is_verbose) {
         $this->io->writeln('<debug>Combined Plugin Statistics:</debug>')->shouldBeCalled();
     }
     $this->testRefreshWithoutCacheWithoutOutput($this->io->reveal(), $database_progress_bar->reveal(), $is_verbose);
 }
开发者ID:console-helpers,项目名称:svn-buddy,代码行数:28,代码来源:RevisionLogTest.php

示例3: _expectCommand

 /**
  * Sets expectation for specific command.
  *
  * @param string       $command    Command.
  * @param string       $output     Output.
  * @param string|null  $error_msg  Error msg.
  * @param integer $error_code Error code.
  */
 private function _expectCommand($command, $output, $error_msg = null, $error_code = 0)
 {
     $process = $this->prophesize('Symfony\\Component\\Process\\Process');
     $expectation = $process->mustRun(strpos($command, 'upgrade') !== false ? Argument::type('callable') : null)->shouldBeCalled();
     if (isset($error_code) && isset($error_msg)) {
         $expectation->willThrow(new RepositoryCommandException($command, 'svn: E' . $error_code . ': ' . $error_msg));
     } else {
         $expectation->willReturn(null);
         $process->getOutput()->willReturn($output)->shouldBeCalled();
     }
     $this->_io->isVerbose()->willReturn(false);
     $this->_io->isDebug()->willReturn(false);
     $this->_processFactory->createProcess($command, 1200)->willReturn($process)->shouldBeCalled();
 }
开发者ID:console-helpers,项目名称:svn-buddy,代码行数:22,代码来源:ConnectorTest.php


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