本文整理汇总了PHP中ApiResult::setMainForContinuation方法的典型用法代码示例。如果您正苦于以下问题:PHP ApiResult::setMainForContinuation方法的具体用法?PHP ApiResult::setMainForContinuation怎么用?PHP ApiResult::setMainForContinuation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApiResult
的用法示例。
在下文中一共展示了ApiResult::setMainForContinuation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDeprecatedContinuation
/**
* @covers ApiResult
*/
public function testDeprecatedContinuation()
{
// Ignore ApiResult deprecation warnings during this test
set_error_handler(function ($errno, $errstr) use(&$warnings) {
if (preg_match('/Use of ApiResult::\\S+ was deprecated in MediaWiki \\d+.\\d+\\./', $errstr)) {
return true;
}
return false;
});
$reset = new ScopedCallback('restore_error_handler');
$allModules = array(new MockApiQueryBase('mock1'), new MockApiQueryBase('mock2'), new MockApiQueryBase('mocklist'));
$generator = new MockApiQueryBase('generator');
$main = new ApiMain(RequestContext::getMain());
$result = new ApiResult(8388608);
$result->setMainForContinuation($main);
$ret = $result->beginContinuation(null, $allModules, array('mock1', 'mock2'));
$this->assertSame(array(false, $allModules), $ret);
$result->setContinueParam($allModules[0], 'm1continue', array(1, 2));
$result->setContinueParam($allModules[2], 'mlcontinue', 2);
$result->setGeneratorContinueParam($generator, 'gcontinue', 3);
$result->endContinuation('raw');
$result->endContinuation('standard');
$this->assertSame(array('mlcontinue' => 2, 'm1continue' => '1|2', 'continue' => '||mock2'), $result->getResultData('continue'));
$this->assertSame(null, $result->getResultData('batchcomplete'));
$this->assertSame(array('mock1' => array('m1continue' => '1|2'), 'mocklist' => array('mlcontinue' => 2), 'generator' => array('gcontinue' => 3)), $result->getResultData('query-continue'));
$main->setContinuationManager(null);
$result = new ApiResult(8388608);
$result->setMainForContinuation($main);
$ret = $result->beginContinuation(null, $allModules, array('mock1', 'mock2'));
$this->assertSame(array(false, $allModules), $ret);
$result->setContinueParam($allModules[0], 'm1continue', array(1, 2));
$result->setGeneratorContinueParam($generator, 'gcontinue', array(3, 4));
$result->endContinuation('raw');
$result->endContinuation('standard');
$this->assertSame(array('m1continue' => '1|2', 'continue' => '||mock2|mocklist'), $result->getResultData('continue'));
$this->assertSame(null, $result->getResultData('batchcomplete'));
$this->assertSame(array('mock1' => array('m1continue' => '1|2'), 'generator' => array('gcontinue' => '3|4')), $result->getResultData('query-continue'));
$main->setContinuationManager(null);
$result = new ApiResult(8388608);
$result->setMainForContinuation($main);
$ret = $result->beginContinuation(null, $allModules, array('mock1', 'mock2'));
$this->assertSame(array(false, $allModules), $ret);
$result->setContinueParam($allModules[2], 'mlcontinue', 2);
$result->setGeneratorContinueParam($generator, 'gcontinue', 3);
$result->endContinuation('raw');
$result->endContinuation('standard');
$this->assertSame(array('mlcontinue' => 2, 'gcontinue' => 3, 'continue' => 'gcontinue||'), $result->getResultData('continue'));
$this->assertSame(true, $result->getResultData('batchcomplete'));
$this->assertSame(array('mocklist' => array('mlcontinue' => 2), 'generator' => array('gcontinue' => 3)), $result->getResultData('query-continue'));
$main->setContinuationManager(null);
$result = new ApiResult(8388608);
$result->setMainForContinuation($main);
$ret = $result->beginContinuation(null, $allModules, array('mock1', 'mock2'));
$this->assertSame(array(false, $allModules), $ret);
$result->setGeneratorContinueParam($generator, 'gcontinue', 3);
$result->endContinuation('raw');
$result->endContinuation('standard');
$this->assertSame(array('gcontinue' => 3, 'continue' => 'gcontinue||mocklist'), $result->getResultData('continue'));
$this->assertSame(true, $result->getResultData('batchcomplete'));
$this->assertSame(array('generator' => array('gcontinue' => 3)), $result->getResultData('query-continue'));
$main->setContinuationManager(null);
$result = new ApiResult(8388608);
$result->setMainForContinuation($main);
$ret = $result->beginContinuation(null, $allModules, array('mock1', 'mock2'));
$this->assertSame(array(false, $allModules), $ret);
$result->setContinueParam($allModules[0], 'm1continue', array(1, 2));
$result->setContinueParam($allModules[2], 'mlcontinue', 2);
$result->endContinuation('raw');
$result->endContinuation('standard');
$this->assertSame(array('mlcontinue' => 2, 'm1continue' => '1|2', 'continue' => '||mock2'), $result->getResultData('continue'));
$this->assertSame(null, $result->getResultData('batchcomplete'));
$this->assertSame(array('mock1' => array('m1continue' => '1|2'), 'mocklist' => array('mlcontinue' => 2)), $result->getResultData('query-continue'));
$main->setContinuationManager(null);
$result = new ApiResult(8388608);
$result->setMainForContinuation($main);
$ret = $result->beginContinuation(null, $allModules, array('mock1', 'mock2'));
$this->assertSame(array(false, $allModules), $ret);
$result->setContinueParam($allModules[0], 'm1continue', array(1, 2));
$result->endContinuation('raw');
$result->endContinuation('standard');
$this->assertSame(array('m1continue' => '1|2', 'continue' => '||mock2|mocklist'), $result->getResultData('continue'));
$this->assertSame(null, $result->getResultData('batchcomplete'));
$this->assertSame(array('mock1' => array('m1continue' => '1|2')), $result->getResultData('query-continue'));
$main->setContinuationManager(null);
$result = new ApiResult(8388608);
$result->setMainForContinuation($main);
$ret = $result->beginContinuation(null, $allModules, array('mock1', 'mock2'));
$this->assertSame(array(false, $allModules), $ret);
$result->setContinueParam($allModules[2], 'mlcontinue', 2);
$result->endContinuation('raw');
$result->endContinuation('standard');
$this->assertSame(array('mlcontinue' => 2, 'continue' => '-||mock1|mock2'), $result->getResultData('continue'));
$this->assertSame(true, $result->getResultData('batchcomplete'));
$this->assertSame(array('mocklist' => array('mlcontinue' => 2)), $result->getResultData('query-continue'));
$main->setContinuationManager(null);
$result = new ApiResult(8388608);
$result->setMainForContinuation($main);
//.........这里部分代码省略.........