MediaWiki REL1_29
AbstractChangesListSpecialPageTestCase.php
Go to the documentation of this file.
1<?php
2
10 // Must be initialized by subclass
15
17
18 protected function setUp() {
20
21 parent::setUp();
22 $this->setMwGlobals( 'wgRCWatchCategoryMembership', true );
23
24 if ( isset( $wgGroupPermissions['patrollers'] ) ) {
25 $this->oldPatrollersGroup = $wgGroupPermissions['patrollers'];
26 }
27
28 $wgGroupPermissions['patrollers'] = [
29 'patrol' => true,
30 ];
31 }
32
33 protected function tearDown() {
35
36 parent::tearDown();
37
38 if ( $this->oldPatrollersGroup !== null ) {
40 }
41 }
42
46 public function testParseParameters( $params, $expected ) {
47 $context = $this->changesListSpecialPage->getContext();
49 $context->setUser( $this->getTestUser( [ 'patrollers' ] )->getUser() );
50 $this->changesListSpecialPage->setContext( $context );
51
52 $this->changesListSpecialPage->registerFilters();
53
54 $opts = new FormOptions();
55 foreach ( $expected as $key => $value ) {
56 // Register it as null so sets aren't rejected.
57 $opts->add(
58 $key,
59 null,
60 FormOptions::guessType( $expected )
61 );
62 }
63
64 $this->changesListSpecialPage->parseParameters(
65 $params,
66 $opts
67 );
68
69 $this->assertArrayEquals(
70 $expected,
71 $opts->getAllValues(),
false, true
74 );
75 }
76}
$wgGroupPermissions
Permission keys given to users in each group.
Abstract base class for shared logic when testing ChangesListSpecialPage and subclasses.
testParseParameters( $params, $expected)
provideParseParameters
Special page which uses a ChangesList to show query results.
getContext()
Get the base IContextSource object.
setContext(IContextSource $context)
Set the IContextSource object.
An IContextSource implementation which will inherit context from another source but allow individual ...
Helper class to keep track of options when mixing links and form elements.
static guessType( $data)
Used to find out which type the data is.
setMwGlobals( $pairs, $value=null)
static getTestUser( $groups=[])
Convenience method for getting an immutable test user.
assertArrayEquals(array $expected, array $actual, $ordered=false, $named=false)
Assert that two arrays are equal.
when a variable name is used in a it is silently declared as a new local masking the global
Definition design.txt:95
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
error also a ContextSource you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext $context
Definition hooks.txt:2728
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:37
$params