MediaWiki  1.23.14
SpecialPreferencesTest.php
Go to the documentation of this file.
1 <?php
14 
22  public function testBug41337() {
23 
24  // Set a low limit
25  $this->setMwGlobals( 'wgMaxSigChars', 2 );
26 
27  $user = $this->getMock( 'User' );
28  $user->expects( $this->any() )
29  ->method( 'isAnon' )
30  ->will( $this->returnValue( false ) );
31 
32  # Yeah foreach requires an array, not NULL =(
33  $user->expects( $this->any() )
34  ->method( 'getEffectiveGroups' )
35  ->will( $this->returnValue( array() ) );
36 
37  # The mocked user has a long nickname
38  $user->expects( $this->any() )
39  ->method( 'getOption' )
40  ->will( $this->returnValueMap( array(
41  array( 'nickname', null, false, 'superlongnickname' ),
42  )
43  ) );
44 
45  # Forge a request to call the special page
46  $context = new RequestContext();
47  $context->setRequest( new FauxRequest() );
48  $context->setUser( $user );
49  $context->setTitle( Title::newFromText( 'Test' ) );
50 
51  # Do the call, should not spurt a fatal error.
53  $special->setContext( $context );
54  $special->execute( array() );
55  }
56 
57 }
FauxRequest
WebRequest clone which takes values from a provided array.
Definition: WebRequest.php:1275
Title\newFromText
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:189
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
SpecialPreferences
A special page that allows users to change their preferences.
Definition: SpecialPreferences.php:29
SpecialPreferencesTest
Test class for SpecialPreferences class.
Definition: SpecialPreferencesTest.php:13
MediaWikiTestCase\setMwGlobals
setMwGlobals( $pairs, $value=null)
Definition: MediaWikiTestCase.php:302
MediaWikiTestCase
Definition: MediaWikiTestCase.php:6
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
RequestContext
Group all the pieces relevant to the context of a request into one instance.
Definition: RequestContext.php:30
SpecialPreferencesTest\testBug41337
testBug41337()
Make sure a nickname which is longer than $wgMaxSigChars is not throwing a fatal error.
Definition: SpecialPreferencesTest.php:22
$user
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
Definition: hooks.txt:237
$special
namespace and then decline to actually register it RecentChangesLinked and Watchlist $special
Definition: hooks.txt:815