MediaWiki
REL1_24
|
00001 <?php 00013 class SpecialPreferencesTest extends MediaWikiTestCase { 00014 00022 public function testBug41337() { 00023 00024 // Set a low limit 00025 $this->setMwGlobals( 'wgMaxSigChars', 2 ); 00026 00027 $user = $this->getMock( 'User' ); 00028 $user->expects( $this->any() ) 00029 ->method( 'isAnon' ) 00030 ->will( $this->returnValue( false ) ); 00031 00032 # Yeah foreach requires an array, not NULL =( 00033 $user->expects( $this->any() ) 00034 ->method( 'getEffectiveGroups' ) 00035 ->will( $this->returnValue( array() ) ); 00036 00037 # The mocked user has a long nickname 00038 $user->expects( $this->any() ) 00039 ->method( 'getOption' ) 00040 ->will( $this->returnValueMap( array( 00041 array( 'nickname', null, false, 'superlongnickname' ), 00042 ) 00043 ) ); 00044 00045 # Forge a request to call the special page 00046 $context = new RequestContext(); 00047 $context->setRequest( new FauxRequest() ); 00048 $context->setUser( $user ); 00049 $context->setTitle( Title::newFromText( 'Test' ) ); 00050 00051 # Do the call, should not spurt a fatal error. 00052 $special = new SpecialPreferences(); 00053 $special->setContext( $context ); 00054 $this->assertNull( $special->execute( array() ) ); 00055 } 00056 00057 }