MediaWiki  1.33.1
SpecialBlockTest.php
Go to the documentation of this file.
1 <?php
2 
6 use Wikimedia\TestingAccessWrapper;
8 
18  protected function newSpecialPage() {
19  return new SpecialBlock();
20  }
21 
22  public function tearDown() {
23  parent::tearDown();
24  $this->resetTables();
25  }
26 
30  public function testGetFormFields() {
31  $this->setMwGlobals( [
32  'wgEnablePartialBlocks' => false,
33  'wgBlockAllowsUTEdit' => true,
34  ] );
35  $page = $this->newSpecialPage();
36  $wrappedPage = TestingAccessWrapper::newFromObject( $page );
37  $fields = $wrappedPage->getFormFields();
38  $this->assertInternalType( 'array', $fields );
39  $this->assertArrayHasKey( 'Target', $fields );
40  $this->assertArrayHasKey( 'Expiry', $fields );
41  $this->assertArrayHasKey( 'Reason', $fields );
42  $this->assertArrayHasKey( 'CreateAccount', $fields );
43  $this->assertArrayHasKey( 'DisableUTEdit', $fields );
44  $this->assertArrayHasKey( 'AutoBlock', $fields );
45  $this->assertArrayHasKey( 'HardBlock', $fields );
46  $this->assertArrayHasKey( 'PreviousTarget', $fields );
47  $this->assertArrayHasKey( 'Confirm', $fields );
48 
49  $this->assertArrayNotHasKey( 'EditingRestriction', $fields );
50  $this->assertArrayNotHasKey( 'PageRestrictions', $fields );
51  $this->assertArrayNotHasKey( 'NamespaceRestrictions', $fields );
52  }
53 
57  public function testGetFormFieldsPartialBlocks() {
58  $this->setMwGlobals( [
59  'wgEnablePartialBlocks' => true,
60  ] );
61  $page = $this->newSpecialPage();
62  $wrappedPage = TestingAccessWrapper::newFromObject( $page );
63  $fields = $wrappedPage->getFormFields();
64 
65  $this->assertArrayHasKey( 'EditingRestriction', $fields );
66  $this->assertArrayHasKey( 'PageRestrictions', $fields );
67  $this->assertArrayHasKey( 'NamespaceRestrictions', $fields );
68  }
69 
73  public function testMaybeAlterFormDefaults() {
74  $this->setMwGlobals( [
75  'wgEnablePartialBlocks' => false,
76  'wgBlockAllowsUTEdit' => true,
77  ] );
78 
79  $block = $this->insertBlock();
80 
81  // Refresh the block from the database.
82  $block = Block::newFromTarget( $block->getTarget() );
83 
84  $page = $this->newSpecialPage();
85 
86  $wrappedPage = TestingAccessWrapper::newFromObject( $page );
87  $wrappedPage->target = $block->getTarget();
88  $fields = $wrappedPage->getFormFields();
89 
90  $this->assertSame( (string)$block->getTarget(), $fields['Target']['default'] );
91  $this->assertSame( $block->isHardblock(), $fields['HardBlock']['default'] );
92  $this->assertSame( $block->isCreateAccountBlocked(), $fields['CreateAccount']['default'] );
93  $this->assertSame( $block->isAutoblocking(), $fields['AutoBlock']['default'] );
94  $this->assertSame( !$block->isUsertalkEditAllowed(), $fields['DisableUTEdit']['default'] );
95  $this->assertSame( $block->getReason(), $fields['Reason']['default'] );
96  $this->assertSame( 'infinite', $fields['Expiry']['default'] );
97  }
98 
103  $this->setMwGlobals( [
104  'wgEnablePartialBlocks' => true,
105  ] );
106 
107  $badActor = $this->getTestUser()->getUser();
108  $sysop = $this->getTestSysop()->getUser();
109  $pageSaturn = $this->getExistingTestPage( 'Saturn' );
110  $pageMars = $this->getExistingTestPage( 'Mars' );
111 
112  $block = new \Block( [
113  'address' => $badActor->getName(),
114  'user' => $badActor->getId(),
115  'by' => $sysop->getId(),
116  'expiry' => 'infinity',
117  'sitewide' => 0,
118  'enableAutoblock' => true,
119  ] );
120 
121  $block->setRestrictions( [
122  new PageRestriction( 0, $pageSaturn->getId() ),
123  new PageRestriction( 0, $pageMars->getId() ),
124  new NamespaceRestriction( 0, NS_TALK ),
125  // Deleted page.
126  new PageRestriction( 0, 999999 ),
127  ] );
128 
129  $block->insert();
130 
131  // Refresh the block from the database.
132  $block = Block::newFromTarget( $block->getTarget() );
133 
134  $page = $this->newSpecialPage();
135 
136  $wrappedPage = TestingAccessWrapper::newFromObject( $page );
137  $wrappedPage->target = $block->getTarget();
138  $fields = $wrappedPage->getFormFields();
139 
140  $titles = [
141  $pageMars->getTitle()->getPrefixedText(),
142  $pageSaturn->getTitle()->getPrefixedText(),
143  ];
144 
145  $this->assertSame( (string)$block->getTarget(), $fields['Target']['default'] );
146  $this->assertSame( 'partial', $fields['EditingRestriction']['default'] );
147  $this->assertSame( implode( "\n", $titles ), $fields['PageRestrictions']['default'] );
148  }
149 
153  public function testProcessForm() {
154  $this->setMwGlobals( [
155  'wgEnablePartialBlocks' => false,
156  ] );
157  $badActor = $this->getTestUser()->getUser();
159 
160  $page = $this->newSpecialPage();
161  $reason = 'test';
162  $expiry = 'infinity';
163  $data = [
164  'Target' => (string)$badActor,
165  'Expiry' => 'infinity',
166  'Reason' => [
167  $reason,
168  ],
169  'Confirm' => '1',
170  'CreateAccount' => '0',
171  'DisableUTEdit' => '0',
172  'DisableEmail' => '0',
173  'HardBlock' => '0',
174  'AutoBlock' => '1',
175  'HideUser' => '0',
176  'Watch' => '0',
177  ];
178  $result = $page->processForm( $data, $context );
179 
180  $this->assertTrue( $result );
181 
182  $block = Block::newFromTarget( $badActor );
183  $this->assertSame( $reason, $block->getReason() );
184  $this->assertSame( $expiry, $block->getExpiry() );
185  }
186 
190  public function testProcessFormExisting() {
191  $this->setMwGlobals( [
192  'wgEnablePartialBlocks' => false,
193  ] );
194  $badActor = $this->getTestUser()->getUser();
195  $sysop = $this->getTestSysop()->getUser();
197 
198  // Create a block that will be updated.
199  $block = new \Block( [
200  'address' => $badActor->getName(),
201  'user' => $badActor->getId(),
202  'by' => $sysop->getId(),
203  'expiry' => 'infinity',
204  'sitewide' => 0,
205  'enableAutoblock' => false,
206  ] );
207  $block->insert();
208 
209  $page = $this->newSpecialPage();
210  $reason = 'test';
211  $expiry = 'infinity';
212  $data = [
213  'Target' => (string)$badActor,
214  'Expiry' => 'infinity',
215  'Reason' => [
216  $reason,
217  ],
218  'Confirm' => '1',
219  'CreateAccount' => '0',
220  'DisableUTEdit' => '0',
221  'DisableEmail' => '0',
222  'HardBlock' => '0',
223  'AutoBlock' => '1',
224  'HideUser' => '0',
225  'Watch' => '0',
226  ];
227  $result = $page->processForm( $data, $context );
228 
229  $this->assertTrue( $result );
230 
231  $block = Block::newFromTarget( $badActor );
232  $this->assertSame( $reason, $block->getReason() );
233  $this->assertSame( $expiry, $block->getExpiry() );
234  $this->assertSame( '1', $block->isAutoblocking() );
235  }
236 
240  public function testProcessFormRestrictions() {
241  $this->setMwGlobals( [
242  'wgEnablePartialBlocks' => true,
243  ] );
244  $badActor = $this->getTestUser()->getUser();
246 
247  $pageSaturn = $this->getExistingTestPage( 'Saturn' );
248  $pageMars = $this->getExistingTestPage( 'Mars' );
249 
250  $titles = [
251  $pageSaturn->getTitle()->getText(),
252  $pageMars->getTitle()->getText(),
253  ];
254 
255  $page = $this->newSpecialPage();
256  $reason = 'test';
257  $expiry = 'infinity';
258  $data = [
259  'Target' => (string)$badActor,
260  'Expiry' => 'infinity',
261  'Reason' => [
262  $reason,
263  ],
264  'Confirm' => '1',
265  'CreateAccount' => '0',
266  'DisableUTEdit' => '0',
267  'DisableEmail' => '0',
268  'HardBlock' => '0',
269  'AutoBlock' => '1',
270  'HideUser' => '0',
271  'Watch' => '0',
272  'EditingRestriction' => 'partial',
273  'PageRestrictions' => implode( "\n", $titles ),
274  'NamespaceRestrictions' => '',
275  ];
276  $result = $page->processForm( $data, $context );
277 
278  $this->assertTrue( $result );
279 
280  $block = Block::newFromTarget( $badActor );
281  $this->assertSame( $reason, $block->getReason() );
282  $this->assertSame( $expiry, $block->getExpiry() );
283  $this->assertCount( 2, $block->getRestrictions() );
284  $this->assertTrue( $this->getBlockRestrictionStore()->equals( $block->getRestrictions(), [
285  new PageRestriction( $block->getId(), $pageMars->getId() ),
286  new PageRestriction( $block->getId(), $pageSaturn->getId() ),
287  ] ) );
288  }
289 
294  $this->setMwGlobals( [
295  'wgEnablePartialBlocks' => true,
296  ] );
297  $badActor = $this->getTestUser()->getUser();
299 
300  $pageSaturn = $this->getExistingTestPage( 'Saturn' );
301  $pageMars = $this->getExistingTestPage( 'Mars' );
302 
303  $titles = [
304  $pageSaturn->getTitle()->getText(),
305  $pageMars->getTitle()->getText(),
306  ];
307 
308  // Create a partial block.
309  $page = $this->newSpecialPage();
310  $reason = 'test';
311  $expiry = 'infinity';
312  $data = [
313  'Target' => (string)$badActor,
314  'Expiry' => 'infinity',
315  'Reason' => [
316  $reason,
317  ],
318  'Confirm' => '1',
319  'CreateAccount' => '0',
320  'DisableUTEdit' => '0',
321  'DisableEmail' => '0',
322  'HardBlock' => '0',
323  'AutoBlock' => '1',
324  'HideUser' => '0',
325  'Watch' => '0',
326  'EditingRestriction' => 'partial',
327  'PageRestrictions' => implode( "\n", $titles ),
328  'NamespaceRestrictions' => '',
329  ];
330  $result = $page->processForm( $data, $context );
331 
332  $this->assertTrue( $result );
333 
334  $block = Block::newFromTarget( $badActor );
335  $this->assertSame( $reason, $block->getReason() );
336  $this->assertSame( $expiry, $block->getExpiry() );
337  $this->assertFalse( $block->isSitewide() );
338  $this->assertCount( 2, $block->getRestrictions() );
339  $this->assertTrue( $this->getBlockRestrictionStore()->equals( $block->getRestrictions(), [
340  new PageRestriction( $block->getId(), $pageMars->getId() ),
341  new PageRestriction( $block->getId(), $pageSaturn->getId() ),
342  ] ) );
343 
344  // Remove a page from the partial block.
345  $data['PageRestrictions'] = $pageMars->getTitle()->getText();
346  $result = $page->processForm( $data, $context );
347 
348  $this->assertTrue( $result );
349 
350  $block = Block::newFromTarget( $badActor );
351  $this->assertSame( $reason, $block->getReason() );
352  $this->assertSame( $expiry, $block->getExpiry() );
353  $this->assertFalse( $block->isSitewide() );
354  $this->assertCount( 1, $block->getRestrictions() );
355  $this->assertTrue( $this->getBlockRestrictionStore()->equals( $block->getRestrictions(), [
356  new PageRestriction( $block->getId(), $pageMars->getId() ),
357  ] ) );
358 
359  // Remove the last page from the block.
360  $data['PageRestrictions'] = '';
361  $result = $page->processForm( $data, $context );
362 
363  $this->assertTrue( $result );
364 
365  $block = Block::newFromTarget( $badActor );
366  $this->assertSame( $reason, $block->getReason() );
367  $this->assertSame( $expiry, $block->getExpiry() );
368  $this->assertFalse( $block->isSitewide() );
369  $this->assertCount( 0, $block->getRestrictions() );
370 
371  // Change to sitewide.
372  $data['EditingRestriction'] = 'sitewide';
373  $result = $page->processForm( $data, $context );
374 
375  $this->assertTrue( $result );
376 
377  $block = Block::newFromTarget( $badActor );
378  $this->assertSame( $reason, $block->getReason() );
379  $this->assertSame( $expiry, $block->getExpiry() );
380  $this->assertTrue( $block->isSitewide() );
381  $this->assertCount( 0, $block->getRestrictions() );
382 
383  // Ensure that there are no restrictions where the blockId is 0.
384  $count = $this->db->selectRowCount(
385  'ipblocks_restrictions',
386  '*',
387  [ 'ir_ipb_id' => 0 ],
388  __METHOD__
389  );
390  $this->assertSame( 0, $count );
391  }
392 
397  public function testCheckUnblockSelf(
398  $blockedUser,
399  $blockPerformer,
400  $adjustPerformer,
401  $adjustTarget,
402  $expectedResult,
403  $reason
404  ) {
405  $this->setMwGlobals( [
406  'wgBlockDisablesLogin' => false,
407  ] );
408  $this->setGroupPermissions( 'sysop', 'unblockself', true );
409  $this->setGroupPermissions( 'user', 'block', true );
410  // Getting errors about creating users in db in provider.
411  // Need to use mutable to ensure different named testusers.
412  $users = [
413  'u1' => TestUserRegistry::getMutableTestUser( __CLASS__, 'sysop' )->getUser(),
414  'u2' => TestUserRegistry::getMutableTestUser( __CLASS__, 'sysop' )->getUser(),
415  'u3' => TestUserRegistry::getMutableTestUser( __CLASS__, 'sysop' )->getUser(),
416  'u4' => TestUserRegistry::getMutableTestUser( __CLASS__, 'sysop' )->getUser(),
417  'nonsysop' => $this->getTestUser()->getUser()
418  ];
419  foreach ( [ 'blockedUser', 'blockPerformer', 'adjustPerformer', 'adjustTarget' ] as $var ) {
420  $$var = $users[$$var];
421  }
422 
423  $block = new \Block( [
424  'address' => $blockedUser->getName(),
425  'user' => $blockedUser->getId(),
426  'by' => $blockPerformer->getId(),
427  'expiry' => 'infinity',
428  'sitewide' => 1,
429  'enableAutoblock' => true,
430  ] );
431 
432  $block->insert();
433 
434  $this->assertSame(
435  SpecialBlock::checkUnblockSelf( $adjustTarget, $adjustPerformer ),
436  $expectedResult,
437  $reason
438  );
439  }
440 
441  public function provideCheckUnblockSelf() {
442  // 'blockedUser', 'blockPerformer', 'adjustPerformer', 'adjustTarget'
443  return [
444  [ 'u1', 'u2', 'u3', 'u4', true, 'Unrelated users' ],
445  [ 'u1', 'u2', 'u1', 'u4', 'ipbblocked', 'Block unrelated while blocked' ],
446  [ 'u1', 'u2', 'u1', 'u1', true, 'Has unblockself' ],
447  [ 'nonsysop', 'u2', 'nonsysop', 'nonsysop', 'ipbnounblockself', 'no unblockself' ],
448  [ 'nonsysop', 'nonsysop', 'nonsysop', 'nonsysop', true, 'no unblockself but can de-selfblock' ],
449  [ 'u1', 'u2', 'u1', 'u2', true, 'Can block user who blocked' ],
450  ];
451  }
452 
453  protected function insertBlock() {
454  $badActor = $this->getTestUser()->getUser();
455  $sysop = $this->getTestSysop()->getUser();
456 
457  $block = new \Block( [
458  'address' => $badActor->getName(),
459  'user' => $badActor->getId(),
460  'by' => $sysop->getId(),
461  'expiry' => 'infinity',
462  'sitewide' => 1,
463  'enableAutoblock' => true,
464  ] );
465 
466  $block->insert();
467 
468  return $block;
469  }
470 
471  protected function resetTables() {
472  $this->db->delete( 'ipblocks', '*', __METHOD__ );
473  $this->db->delete( 'ipblocks_restrictions', '*', __METHOD__ );
474  }
475 
482  $loadBalancer = $this->getMockBuilder( LoadBalancer::class )
483  ->disableOriginalConstructor()
484  ->getMock();
485 
486  return new BlockRestrictionStore( $loadBalancer );
487  }
488 }
SpecialBlockTest
Blocking Database @coversDefaultClass SpecialBlock.
Definition: SpecialBlockTest.php:14
$context
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext $context
Definition: hooks.txt:2644
MediaWikiTestCase\getTestUser
static getTestUser( $groups=[])
Convenience method for getting an immutable test user.
Definition: MediaWikiTestCase.php:180
SpecialBlock\checkUnblockSelf
static checkUnblockSelf( $target, User $performer)
T17810: blocked admins should not be able to block/unblock others, and probably shouldn't be able to ...
Definition: SpecialBlock.php:1124
SpecialBlockTest\getBlockRestrictionStore
getBlockRestrictionStore()
Get a BlockRestrictionStore instance.
Definition: SpecialBlockTest.php:481
SpecialBlockTest\newSpecialPage
newSpecialPage()
@inheritDoc
Definition: SpecialBlockTest.php:18
SpecialBlockTest\testProcessForm
testProcessForm()
::processForm()
Definition: SpecialBlockTest.php:153
$result
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message. Please note the header message cannot receive/use parameters. 'ImgAuthModifyHeaders':Executed just before a file is streamed to a user via img_auth.php, allowing headers to be modified beforehand. $title:LinkTarget object & $headers:HTTP headers(name=> value, names are case insensitive). Two headers get special handling:If-Modified-Since(value must be a valid HTTP date) and Range(must be of the form "bytes=(\d*-\d*)") will be honored when streaming the file. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item. Return false to stop further processing of the tag $reader:XMLReader object $logInfo:Array of information 'ImportHandlePageXMLTag':When parsing a XML tag in a page. Return false to stop further processing of the tag $reader:XMLReader object & $pageInfo:Array of information 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. Return false to stop further processing of the tag $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. Return false to stop further processing of the tag $reader:XMLReader object 'ImportHandleUnknownUser':When a user doesn 't exist locally, this hook is called to give extensions an opportunity to auto-create it. If the auto-creation is successful, return false. $name:User name 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. Return false to stop further processing of the tag $reader:XMLReader object $revisionInfo:Array of information 'ImportLogInterwikiLink':Hook to change the interwiki link used in log entries and edit summaries for transwiki imports. & $fullInterwikiPrefix:Interwiki prefix, may contain colons. & $pageTitle:String that contains page title. 'ImportSources':Called when reading from the $wgImportSources configuration variable. Can be used to lazy-load the import sources list. & $importSources:The value of $wgImportSources. Modify as necessary. See the comment in DefaultSettings.php for the detail of how to structure this array. 'InfoAction':When building information to display on the action=info page. $context:IContextSource object & $pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect. & $title:Title object for the current page & $request:WebRequest & $ignoreRedirect:boolean to skip redirect check & $target:Title/string of redirect target & $article:Article object 'InternalParseBeforeLinks':during Parser 's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InternalParseBeforeSanitize':during Parser 's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings. Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not. Return true without providing an interwiki to continue interwiki search. $prefix:interwiki prefix we are looking for. & $iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InvalidateEmailComplete':Called after a user 's email has been invalidated successfully. $user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification. Callee may modify $url and $query, URL will be constructed as $url . $query & $url:URL to index.php & $query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) & $article:article(object) being checked 'IsTrustedProxy':Override the result of IP::isTrustedProxy() & $ip:IP being check & $result:Change this value to override the result of IP::isTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from & $allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of Sanitizer::validateEmail(), for instance to return false if the domain name doesn 't match your organization. $addr:The e-mail address entered by the user & $result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user & $result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we 're looking for a messages file for & $file:The messages file path, you can override this to change the location. 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces. Do not use this hook to add namespaces. Use CanonicalNamespaces for that. & $namespaces:Array of namespaces indexed by their numbers 'LanguageGetTranslatedLanguageNames':Provide translated language names. & $names:array of language code=> language name $code:language of the preferred translations 'LanguageLinks':Manipulate a page 's language links. This is called in various places to allow extensions to define the effective language links for a page. $title:The page 's Title. & $links:Array with elements of the form "language:title" in the order that they will be output. & $linkFlags:Associative array mapping prefixed links to arrays of flags. Currently unused, but planned to provide support for marking individual language links in the UI, e.g. for featured articles. 'LanguageSelector':Hook to change the language selector available on a page. $out:The output page. $cssClassName:CSS class name of the language selector. 'LinkBegin':DEPRECATED since 1.28! Use HtmlPageLinkRendererBegin instead. Used when generating internal and interwiki links in Linker::link(), before processing starts. Return false to skip default processing and return $ret. See documentation for Linker::link() for details on the expected meanings of parameters. $skin:the Skin object $target:the Title that the link is pointing to & $html:the contents that the< a > tag should have(raw HTML) $result
Definition: hooks.txt:1991
Block\newFromTarget
static newFromTarget( $specificTarget, $vagueTarget=null, $fromMaster=false)
Given a target and the target's type, get an existing Block object if possible.
Definition: Block.php:1403
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
SpecialBlockTest\testGetFormFields
testGetFormFields()
::getFormFields()
Definition: SpecialBlockTest.php:30
$data
$data
Utility to generate mapping file used in mw.Title (phpCharToUpper.json)
Definition: generatePhpCharToUpperMappings.php:13
SpecialPageTestBase
Base class for testing special pages.
Definition: SpecialPageTestBase.php:14
SpecialBlockTest\resetTables
resetTables()
Definition: SpecialBlockTest.php:471
SpecialBlockTest\tearDown
tearDown()
Definition: SpecialBlockTest.php:22
$titles
linkcache txt The LinkCache class maintains a list of article titles and the information about whether or not the article exists in the database This is used to mark up links when displaying a page If the same link appears more than once on any page then it only has to be looked up once In most cases link lookups are done in batches with the LinkBatch class or the equivalent in so the link cache is mostly useful for short snippets of parsed and for links in the navigation areas of the skin The link cache was formerly used to track links used in a document for the purposes of updating the link tables This application is now deprecated To create a you can use the following $titles
Definition: linkcache.txt:17
SpecialBlock
A special page that allows users with 'block' right to block users from editing pages and other actio...
Definition: SpecialBlock.php:34
MediaWikiTestCase\setMwGlobals
setMwGlobals( $pairs, $value=null)
Sets a global, maintaining a stashed version of the previous global to be restored in tearDown.
Definition: MediaWikiTestCase.php:709
SpecialBlockTest\testMaybeAlterFormDefaultsPartial
testMaybeAlterFormDefaultsPartial()
::maybeAlterFormDefaults()
Definition: SpecialBlockTest.php:102
use
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Definition: MIT-LICENSE.txt:10
SpecialBlockTest\testMaybeAlterFormDefaults
testMaybeAlterFormDefaults()
::maybeAlterFormDefaults()
Definition: SpecialBlockTest.php:73
MediaWikiTestCase\$users
static TestUser[] $users
Definition: MediaWikiTestCase.php:53
SpecialBlockTest\testProcessFormExisting
testProcessFormExisting()
::processForm()
Definition: SpecialBlockTest.php:190
string
This code would result in ircNotify being run twice when an article is and once for brion Hooks can return three possible true was required This is the default since MediaWiki *some string
Definition: hooks.txt:175
SpecialBlockTest\insertBlock
insertBlock()
Definition: SpecialBlockTest.php:453
Wikimedia\Rdbms\LoadBalancer
Database connection, tracking, load balancing, and transaction manager for a cluster.
Definition: LoadBalancer.php:41
SpecialBlockTest\testProcessFormRestrictionsChange
testProcessFormRestrictionsChange()
::processForm()
Definition: SpecialBlockTest.php:293
MediaWikiTestCase\getTestSysop
static getTestSysop()
Convenience method for getting an immutable admin test user.
Definition: MediaWikiTestCase.php:204
MediaWikiTestCase\setGroupPermissions
setGroupPermissions( $newPerms, $newKey=null, $newValue=null)
Alters $wgGroupPermissions for the duration of the test.
Definition: MediaWikiTestCase.php:1095
RequestContext\getMain
static getMain()
Get the RequestContext object associated with the main request.
Definition: RequestContext.php:430
MediaWikiTestCase\getExistingTestPage
getExistingTestPage( $title=null)
Returns a WikiPage representing an existing page.
Definition: MediaWikiTestCase.php:220
MediaWiki\Block\Restriction\NamespaceRestriction
Definition: NamespaceRestriction.php:25
SpecialBlockTest\provideCheckUnblockSelf
provideCheckUnblockSelf()
Definition: SpecialBlockTest.php:441
MediaWiki\Block\Restriction\PageRestriction
Definition: PageRestriction.php:25
SpecialBlockTest\testProcessFormRestrictions
testProcessFormRestrictions()
::processForm()
Definition: SpecialBlockTest.php:240
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
NS_TALK
const NS_TALK
Definition: Defines.php:65
class
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
Definition: maintenance.txt:52
TestUserRegistry\getMutableTestUser
static getMutableTestUser( $testName, $groups=[])
Get a TestUser object that the caller may modify.
Definition: TestUserRegistry.php:34
SpecialBlockTest\testGetFormFieldsPartialBlocks
testGetFormFieldsPartialBlocks()
::getFormFields()
Definition: SpecialBlockTest.php:57
SpecialBlockTest\testCheckUnblockSelf
testCheckUnblockSelf( $blockedUser, $blockPerformer, $adjustPerformer, $adjustTarget, $expectedResult, $reason)
provideCheckUnblockSelf ::checkUnblockSelf
Definition: SpecialBlockTest.php:397
MediaWiki\Block\BlockRestrictionStore
Definition: BlockRestrictionStore.php:33