本文整理匯總了PHP中Prophecy\Prophecy\ObjectProphecy::writeln方法的典型用法代碼示例。如果您正苦於以下問題:PHP ObjectProphecy::writeln方法的具體用法?PHP ObjectProphecy::writeln怎麽用?PHP ObjectProphecy::writeln使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Prophecy\Prophecy\ObjectProphecy
的用法示例。
在下文中一共展示了ObjectProphecy::writeln方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testRefreshWithoutCache
public function testRefreshWithoutCache()
{
$new_collected_data = array('mocked' => array('NEW_COLLECTED'));
$cache_invalidator = new RegExToken('/^main:[\\d]+;plugin\\(mocked\\):[\\d]+$/');
$this->repositoryConnector->getFirstRevision('svn://localhost')->willReturn(1000)->shouldBeCalled();
$this->repositoryConnector->getLastRevision('svn://localhost')->willReturn(3000)->shouldBeCalled();
$this->repositoryConnector->getProjectUrl('svn://localhost/trunk')->willReturn('svn://localhost')->shouldBeCalled();
$this->cacheManager->getCache('log:svn://localhost', $cache_invalidator)->shouldBeCalled();
$this->cacheManager->setCache('log:svn://localhost', $new_collected_data, $cache_invalidator)->shouldBeCalled();
$progress_bar = $this->prophesize('Symfony\\Component\\Console\\Helper\\ProgressBar');
$progress_bar->setFormat(' * Reading missing revisions: %current%/%max% [%bar%] %percent:3s%%')->shouldBeCalled();
$progress_bar->start()->shouldBeCalled();
$progress_bar->advance()->shouldBeCalled();
$progress_bar->finish()->shouldBeCalled();
$this->io->createProgressBar(2)->willReturn($progress_bar)->shouldBeCalled();
$this->io->writeln('')->shouldBeCalled();
$plugin = $this->prophesize('ConsoleHelpers\\SVNBuddy\\Repository\\RevisionLog\\IRevisionLogPlugin');
$plugin->getName()->willReturn('mocked')->shouldBeCalled();
$plugin->getCacheInvalidator()->willReturn(5)->shouldBeCalled();
$plugin->getLastRevision()->shouldBeCalled();
$plugin->parse(new SimpleXMLElementToken($this->expectSvnLogQuery(1000, 2000)))->shouldBeCalled();
$plugin->parse(new SimpleXMLElementToken($this->expectSvnLogQuery(2001, 3000)))->shouldBeCalled();
$plugin->getCollectedData()->willReturn($new_collected_data['mocked'])->shouldBeCalled();
$revision_log = $this->createRevisionLog('svn://localhost/trunk');
$revision_log->registerPlugin($plugin->reveal());
$revision_log->refresh();
}
示例2: testDebugOutput
public function testDebugOutput()
{
$this->_process->getCommandLine()->willReturn('svn log')->shouldBeCalled();
$this->_process->mustRun(null)->shouldBeCalled();
$this->_process->getOutput()->willReturn('OK')->shouldBeCalled();
$this->_io->isVerbose()->willReturn(false)->shouldBeCalled();
$this->_io->isDebug()->willReturn(true)->shouldBeCalled();
$this->_cacheManager->getCache(Argument::any())->shouldNotBeCalled();
$this->_io->writeln('OK', OutputInterface::OUTPUT_RAW)->shouldBeCalled();
$this->_command->run();
}
示例3: testGetWorkingCopyUrlOnOldFormatWorkingCopyAndUpgradeRejected
public function testGetWorkingCopyUrlOnOldFormatWorkingCopyAndUpgradeRejected()
{
$this->_io->writeln(array('', '<error>error message</error>', ''))->shouldBeCalled();
$this->_io->askConfirmation('Run "svn upgrade"', false)->willReturn(false)->shouldBeCalled();
$this->_expectCommand("svn --non-interactive info --xml '/path/to/working-copy'", '', 'error message', RepositoryCommandException::SVN_ERR_WC_UPGRADE_REQUIRED);
$exception_msg = <<<MESSAGE
Command:
svn --non-interactive info --xml '/path/to/working-copy'
Error #%d:
error message
MESSAGE;
$this->setExpectedException('ConsoleHelpers\\SVNBuddy\\Exception\\RepositoryCommandException', sprintf($exception_msg, RepositoryCommandException::SVN_ERR_WC_UPGRADE_REQUIRED));
$this->_repositoryConnector->getWorkingCopyUrl('/path/to/working-copy');
}
示例4: testRefreshWithoutCacheWithoutOutput
public function testRefreshWithoutCacheWithoutOutput(ConsoleIO $io = null, ProgressBar $database_progress_bar = null, $is_verbose = false)
{
$this->repositoryConnector->getLastRevision('svn://localhost')->willReturn(400)->shouldBeCalled();
// Create revision log (part 1).
$revision_log = $this->createRevisionLog('svn://localhost/projects/project-name/trunk', $io);
// Add repository collector plugin.
$repository_collector_plugin = $this->prophesize('ConsoleHelpers\\SVNBuddy\\Repository\\RevisionLog\\Plugin\\IRepositoryCollectorPlugin');
$repository_collector_plugin->getName()->willReturn('mocked_repo')->shouldBeCalled();
$repository_collector_plugin->setRevisionLog($revision_log)->shouldBeCalled();
$repository_collector_plugin->whenDatabaseReady()->shouldBeCalled();
$repository_collector_plugin->getLastRevision()->willReturn(0)->shouldBeCalled();
$repository_collector_plugin->getRevisionQueryFlags()->willReturn(array(RevisionLog::FLAG_MERGE_HISTORY, RevisionLog::FLAG_VERBOSE))->shouldBeCalled();
$repository_collector_plugin->parse(new SimpleXMLElementToken($this->expectSvnLogQuery(0, 199)))->shouldBeCalled();
$repository_collector_plugin->parse(new SimpleXMLElementToken($this->expectSvnLogQuery(200, 399)))->shouldBeCalled();
$repository_collector_plugin->parse(new SimpleXMLElementToken($this->expectSvnLogQuery(400, 400)))->shouldBeCalled();
if ($is_verbose) {
$repository_collector_plugin->getStatistics()->willReturn(array('rp1' => 10, 'rp2' => 20))->shouldBeCalled();
$this->io->writeln('<debug> * rp1: 10</debug>')->shouldBeCalled();
$this->io->writeln('<debug> * rp2: 20</debug>')->shouldBeCalled();
}
// Add database collector plugin.
$database_collector_plugin = $this->prophesize('ConsoleHelpers\\SVNBuddy\\Repository\\RevisionLog\\Plugin\\IDatabaseCollectorPlugin');
$database_collector_plugin->getName()->willReturn('mocked_db')->shouldBeCalled();
$database_collector_plugin->setRevisionLog($revision_log)->shouldBeCalled();
$database_collector_plugin->whenDatabaseReady()->shouldBeCalled();
$database_collector_plugin->getLastRevision()->willReturn(0)->shouldBeCalled();
$database_collector_plugin->process(0, 400, $database_progress_bar)->will(function (array $args) {
if (isset($args[2])) {
$args[2]->advance();
}
})->shouldBeCalled();
if ($is_verbose) {
$database_collector_plugin->getStatistics()->willReturn(array('dp1' => 3, 'dp2' => 4))->shouldBeCalled();
$this->io->writeln('<debug> * dp1: 3</debug>')->shouldBeCalled();
$this->io->writeln('<debug> * dp2: 4</debug>')->shouldBeCalled();
}
// Create revision log (part 2).
$revision_log->registerPlugin($repository_collector_plugin->reveal());
$revision_log->registerPlugin($database_collector_plugin->reveal());
$revision_log->refresh(false);
}
示例5: outputWritesLine
public static function outputWritesLine(ObjectProphecy $output, $line)
{
$output->writeln($line)->shouldBeCalled();
}
示例6: testWriteln
public function testWriteln()
{
$this->output->writeln('text', OutputInterface::OUTPUT_NORMAL)->shouldBeCalled();
$this->io->writeln('text', OutputInterface::OUTPUT_NORMAL);
}
示例7: expectVerboseOutput
/**
* Expects verbose output.
*
* @param ObjectProphecy $io ConsoleIO mock.
* @param string $regexp Regexp.
*
* @return void
*/
protected function expectVerboseOutput(ObjectProphecy $io, $regexp)
{
$io->writeln(Argument::that(function (array $messages) use($regexp) {
return count($messages) === 2 && $messages[0] === '' && preg_match($regexp, $messages[1]);
}))->shouldBeCalled();
}