本文整理汇总了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());
}
示例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);
}
示例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();
}