本文整理汇总了PHP中SpecialPageFactory::resetList方法的典型用法代码示例。如果您正苦于以下问题:PHP SpecialPageFactory::resetList方法的具体用法?PHP SpecialPageFactory::resetList怎么用?PHP SpecialPageFactory::resetList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpecialPageFactory
的用法示例。
在下文中一共展示了SpecialPageFactory::resetList方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetAliasListRecursion
public function testGetAliasListRecursion()
{
$called = false;
$this->mergeMwGlobalArrayValue('wgHooks', array('SpecialPage_initList' => array(function () use(&$called) {
SpecialPageFactory::getLocalNameFor('Specialpages');
$called = true;
})));
SpecialPageFactory::resetList();
SpecialPageFactory::getLocalNameFor('Specialpages');
$this->assertTrue($called, 'Recursive call succeeded');
}
示例2: testConflictResolution
/**
* @dataProvider provideTestConflictResolution
*/
public function testConflictResolution($test, $aliasesList, $alias, $expectedName, $expectedAlias, $expectWarnings)
{
global $wgContLang;
$lang = clone $wgContLang;
$lang->mExtendedSpecialPageAliases = $aliasesList;
$this->setMwGlobals('wgContLang', $lang);
$this->setMwGlobals('wgSpecialPages', array_combine(array_keys($aliasesList), array_keys($aliasesList)));
SpecialPageFactory::resetList();
// Catch the warnings we expect to be raised
$warnings = array();
$this->setMwGlobals('wgDevelopmentWarnings', true);
set_error_handler(function ($errno, $errstr) use(&$warnings) {
if (preg_match('/First alias \'[^\']*\' for .*/', $errstr) || preg_match('/Did not find a usable alias for special page .*/', $errstr)) {
$warnings[] = $errstr;
return true;
}
return false;
});
$reset = new ScopedCallback('restore_error_handler');
list($name, ) = SpecialPageFactory::resolveAlias($alias);
$this->assertEquals($expectedName, $name, "{$test}: Alias to name");
$result = SpecialPageFactory::getLocalNameFor($name);
$this->assertEquals($expectedAlias, $result, "{$test}: Alias to name to alias");
$gotWarnings = count($warnings);
if ($gotWarnings !== $expectWarnings) {
$this->fail("Expected {$expectWarnings} warning(s), but got {$gotWarnings}:\n" . join("\n", $warnings));
}
}
示例3: tearDown
public function tearDown()
{
parent::tearDown();
TestingAccessWrapper::newFromClass('Hooks')->handlers = $this->originalHandlers;
SpecialPageFactory::resetList();
}
示例4: testBug71329
public function testBug71329()
{
SpecialPageFactory::resetList();
RequestContext::resetMain();
$req = new FauxRequest(array('title' => 'Special:Search', 'mobileaction' => 'toggle_view_mobile'));
$req->setRequestURL('/w/index.php?title=Special:Search&mobileaction=toggle_view_mobile');
RequestContext::getMain()->setRequest($req);
MobileContext::setInstance(null);
$this->setMwGlobals('wgTitle', null);
SpecialPage::getTitleFor('Search');
$this->assertTrue(true, 'In case of failure this test just crashes');
}