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


PHP SearchEngine::setNamespaces方法代码示例

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


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

示例1: setUp

 protected function setUp()
 {
     parent::setUp();
     if (!$this->isWikitextNS(NS_MAIN)) {
         $this->markTestSkipped('Main namespace does not support wikitext.');
     }
     // Avoid special pages from extensions interferring with the tests
     $this->setMwGlobals('wgSpecialPages', array());
     $this->search = SearchEngine::create();
     $this->search->setNamespaces(array());
 }
开发者ID:OrBin,项目名称:mediawiki,代码行数:11,代码来源:SearchEnginePrefixTest.php

示例2: setUp

 protected function setUp()
 {
     parent::setUp();
     if (!$this->isWikitextNS(NS_MAIN)) {
         $this->markTestSkipped('Main namespace does not support wikitext.');
     }
     // Avoid special pages from extensions interferring with the tests
     $this->setMwGlobals(['wgSpecialPages' => [], 'wgHooks' => []]);
     $this->search = MediaWikiServices::getInstance()->newSearchEngine();
     $this->search->setNamespaces([]);
     $this->originalHandlers = TestingAccessWrapper::newFromClass('Hooks')->handlers;
     TestingAccessWrapper::newFromClass('Hooks')->handlers = [];
     SpecialPageFactory::resetList();
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:14,代码来源:SearchEnginePrefixTest.php

示例3: testAugmentorSearch

 public function testAugmentorSearch()
 {
     $this->search->setNamespaces([0, 1, 4]);
     $resultSet = $this->search->searchText('smithee');
     // Not using mock since PHPUnit mocks do not work properly with references in params
     $this->mergeMwGlobalArrayValue('wgHooks', ['SearchResultsAugment' => [[$this, 'addAugmentors']]]);
     $this->search->augmentSearchResults($resultSet);
     for ($result = $resultSet->next(); $result; $result = $resultSet->next()) {
         $id = $result->getTitle()->getArticleID();
         $augmentData = "Result:{$id}:" . $result->getTitle()->getText();
         $augmentData2 = "Result2:{$id}:" . $result->getTitle()->getText();
         $this->assertEquals(['testSet' => $augmentData, 'testRow' => $augmentData2], $result->getExtensionData());
     }
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:14,代码来源:SearchEngineTest.php

示例4: testTextTitlePowerSearch

 public function testTextTitlePowerSearch()
 {
     $this->search->setNamespaces(array(0, 1, 4));
     $this->assertEquals(array('Alan Smithee', 'Smithee', 'Talk:Smithee'), $this->fetchIds($this->search->searchTitle('smithee')), "Title power search failed");
 }
开发者ID:Habatchii,项目名称:wikibase-for-mediawiki,代码行数:5,代码来源:SearchEngineTest.php


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