41 $this->context->setTitle( Title::newFromText( self::class ) );
43 $services = MediaWikiServices::getInstance();
46 $this->config =
$services->getMainConfig();
57 AuthManager::singleton(),
58 MediaWikiServices::getInstance()->getLinkRenderer()
71 $this->
assertCount( 5, $form->getPreferenceSections() );
83 $this->
assertEquals( $cssClass, $prefs[
'emailauthentication'][
'cssclass'] );
91 ->disableOriginalConstructor()
93 $userMock->method(
'isAllowed' )
94 ->willReturn(
false );
95 $userMock->method(
'getEffectiveGroups' )
97 $userMock->method(
'getGroupMemberships' )
99 $userMock->method(
'getOptions' )
100 ->willReturn( [
'test' =>
'yes' ] );
111 ->disableOriginalConstructor()
113 $userMock->method(
'isAllowed' )
114 ->willReturn(
true );
115 $userMock->method(
'getEffectiveGroups' )
117 $userMock->method(
'getGroupMemberships' )
119 $userMock->method(
'getOptions' )
120 ->willReturn( [
'test' =>
'yes' ] );
125 'rendering/advancedrendering',
126 $prefs[
'showrollbackconfirmation'][
'section']
131 $userNoEmail =
new User;
132 $userEmailUnauthed =
new User;
133 $userEmailUnauthed->
setEmail(
'noauth@example.org' );
134 $userEmailAuthed =
new User;
135 $userEmailAuthed->
setEmail(
'noauth@example.org' );
136 $userEmailAuthed->setEmailAuthenticationTimestamp(
wfTimestamp() );
166 ->disableOriginalConstructor()
170 ->disableOriginalConstructor()
172 $userMock->method(
'getOptions' )
173 ->willReturn( $oldOptions );
174 $userMock->method(
'isAllowedAny' )
175 ->willReturn(
true );
176 $userMock->method(
'isAllowed' )
177 ->willReturn(
true );
179 $userMock->expects( $this->
exactly( 2 ) )
180 ->method(
'setOption' )
182 [ $this->
equalTo(
'test' ), $this->
equalTo( $newOptions[
'test' ] ) ],
183 [ $this->
equalTo(
'option' ), $this->
equalTo( $newOptions[
'option' ] ) ]
186 $form->expects( $this->
any() )
187 ->method(
'getModifiedUser' )
188 ->willReturn( $userMock );
190 $form->expects( $this->
any() )
191 ->method(
'getContext' )
192 ->willReturn( $this->context );
194 $form->expects( $this->
any() )
195 ->method(
'getConfig' )
196 ->willReturn( $configMock );
199 function ( $formData, $form, $user, &$result, $oldUserOptions )
200 use ( $newOptions, $oldOptions, $userMock ) {
202 foreach ( $newOptions as $option =>
$value ) {
205 foreach ( $oldOptions as $option =>
$value ) {
214 $factory->saveFormData( $newOptions, $form, [] );
224 $this->context->getRequest()->setVal(
'wprclimit',
' 0012 ' );
229 $this->
assertEquals( 12, $user->getOption(
'rclimit' ) );
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
they could even be mouse clicks or menu items whatever suits your program You should also get your if any
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
testGetForm()
MediaWiki\Preferences\DefaultPreferencesFactory::getForm()
testPreferencesFormPreSaveHookHasCorrectData()
Test that PreferencesFormPreSave hook has correct data:
emailAuthenticationProvider()
getPreferencesFactory()
Get a basic PreferencesFactory for testing with.
testEmailAuthentication( $user, $cssClass)
CSS classes for emailauthentication preference field when there's no email.
testShowRollbackConfIsHiddenForUsersWithoutRollbackRights()
MediaWiki\Preferences\DefaultPreferencesFactory::renderingPreferences()
testIntvalFilter()
The rclimit preference should accept non-integer input and filter it to become an integer.
testShowRollbackConfIsShownForUsersWithRollbackRights()
MediaWiki\Preferences\DefaultPreferencesFactory::renderingPreferences()
A Config instance which stores all settings as a member variable.
Internationalisation code.
Group all the pieces relevant to the context of a request into one instance.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
setEmail( $str)
Set the user's e-mail address.
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title e g db for database replication lag or jobqueue for job queue size converted to pseudo seconds It is possible to add more fields and they will be returned to the user in the API response after the basic globals have been set but before ordinary actions take place or wrap services the preferred way to define a new service is the $wgServiceWiringFiles array $services
Interface for configuration instances.
Interface for objects which can provide a MediaWiki context on request.