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


PHP ApiResult::setContinueParam方法代码示例

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


在下文中一共展示了ApiResult::setContinueParam方法的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);
//.........这里部分代码省略.........
开发者ID:ucfengzhun,项目名称:mediawiki,代码行数:101,代码来源:ApiResultTest.php


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