2use Wikimedia\ScopedCallback;
41 'SpecialPage_initList' => [
42 function () use ( &$count ) {
49 $this->assertEquals( 1, $count );
60 'class name' => [
'SpecialAllPages',
false ],
61 'closure' => [
function () {
64 'function' => [ [ $this,
'newSpecialAllPages' ],
false ],
65 'callback string' => [
'SpecialPageTestHelper::newSpecialAllPages',
false ],
66 'callback with object' => [
67 [ $specialPageTestHelper,
'newSpecialAllPages' ],
71 [
'SpecialPageTestHelper',
'newSpecialAllPages' ],
86 $this->assertInstanceOf(
'SpecialPage', $page );
89 $this->assertEquals( $shouldReuseInstance, $page2 === $page,
"Should re-use instance:" );
100 $this->assertInternalType(
'array', $names );
101 $this->assertContains(
'testdummy', $names );
108 $this->
setMwGlobals(
'wgContLang', Language::factory(
'de' ) );
112 $this->assertEquals(
'Specialpages', $name );
113 $this->assertEquals(
'Foo', $param );
120 $this->
setMwGlobals(
'wgContLang', Language::factory(
'de' ) );
124 $this->assertEquals(
'Spezialseiten/Foo', $name );
131 $this->
setMwGlobals(
'wgContLang', Language::factory(
'de' ) );
135 $this->assertEquals(
'Spezialseiten/Foo', $title->getText() );
136 $this->assertEquals(
NS_SPECIAL, $title->getNamespace() );
143 $test, $aliasesList, $alias, $expectedName, $expectedAlias, $expectWarnings
147 $lang->mExtendedSpecialPageAliases = $aliasesList;
150 array_combine( array_keys( $aliasesList ), array_keys( $aliasesList ) )
157 set_error_handler(
function ( $errno, $errstr ) use ( &$warnings ) {
158 if ( preg_match(
'/First alias \'[^\']*\' for .*/', $errstr ) ||
159 preg_match(
'/Did not find a usable alias for special page .*/', $errstr )
161 $warnings[] = $errstr;
166 $reset =
new ScopedCallback(
'restore_error_handler' );
169 $this->assertEquals( $expectedName, $name,
"$test: Alias to name" );
171 $this->assertEquals( $expectedAlias, $result,
"$test: Alias to name to alias" );
173 $gotWarnings = count( $warnings );
174 if ( $gotWarnings !== $expectWarnings ) {
175 $this->fail(
"Expected $expectWarnings warning(s), but got $gotWarnings:\n" .
176 implode(
"\n", $warnings )
185 $test, $aliasesList, $alias, $expectedName, $expectedAlias, $expectWarnings
188 $aliasesList = array_reverse( $aliasesList );
190 $test, $aliasesList, $alias, $expectedName, $expectedAlias, $expectWarnings
197 'Canonical name wins',
198 [
'Foo' => [
'Foo',
'Bar' ],
'Baz' => [
'Foo',
'BazPage',
'Baz2' ] ],
206 'Doesn\'t redirect to a different special page\'s canonical name',
207 [
'Foo' => [
'Foo',
'Bar' ],
'Baz' => [
'Foo',
'BazPage',
'Baz2' ] ],
215 'Canonical name wins even if not aliased',
216 [
'Foo' => [
'FooPage' ],
'Baz' => [
'Foo',
'BazPage',
'Baz2' ] ],
224 'Doesn\'t redirect to a different special page\'s canonical name even if not aliased',
225 [
'Foo' => [
'FooPage' ],
'Baz' => [
'Foo',
'BazPage',
'Baz2' ] ],
233 'First local name beats non-first',
234 [
'First' => [
'Foo' ],
'NonFirst' => [
'Bar',
'Foo' ] ],
242 'Doesn\'t redirect to a different special page\'s first alias',
245 'First' => [
'Bar' ],
246 'Baz' => [
'Foo',
'Bar',
'BazPage',
'Baz2' ]
255 'Doesn\'t redirect wrong even if all aliases conflict',
258 'First' => [
'Bar' ],
259 'Baz' => [
'Foo',
'Bar' ]
273 'SpecialPage_initList' => [
282 $this->assertTrue(
$called,
'Recursive call succeeded' );
Implements Special:Allpages.
Factory for handling the special page list and generating SpecialPage objects.
testGetNames()
SpecialPageFactory::getNames.
testGetTitleForAlias()
SpecialPageFactory::getTitleForAlias.
testConflictResolutionReversed( $test, $aliasesList, $alias, $expectedName, $expectedAlias, $expectWarnings)
provideTestConflictResolution
testConflictResolution( $test, $aliasesList, $alias, $expectedName, $expectedAlias, $expectWarnings)
provideTestConflictResolution
provideTestConflictResolution()
testResolveAlias()
SpecialPageFactory::resolveAlias.
testGetPage( $spec, $shouldReuseInstance)
SpecialPageFactory::getPage specialPageProvider.
testGetAliasListRecursion()
testGetLocalNameFor()
SpecialPageFactory::getLocalNameFor.
static getLocalNameFor( $name, $subpage=false)
Get the local name for a specified canonical name.
static getTitleForAlias( $alias)
Get a title for a given alias.
static getPage( $name)
Find the object with a given name and return it (or NULL)
static resetList()
Reset the internal list of special pages.
static getNames()
Returns a list of canonical special page names.
static resolveAlias( $alias)
Given a special page name with a possible subpage, return an array where the first element is the spe...
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Ge...
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
processing should stop and the error should be shown to the user * false
if(!isset( $args[0])) $lang