18 parent::__construct(
$name,
$data, $dataName );
25 $enhancedChangesList->beginRecentChangesList();
27 $styleModules = $enhancedChangesList->getOutput()->getModuleStyles();
29 $this->assertContains(
35 $this->assertContains(
36 'mediawiki.special.changeslist',
38 'has mediawiki.special.changeslist'
41 $this->assertContains(
42 'mediawiki.special.changeslist.enhanced',
44 'has mediawiki.special.changeslist.enhanced'
50 $enhancedChangesList->beginRecentChangesList();
52 $modules = $enhancedChangesList->getOutput()->getModules();
54 $this->assertContains(
'jquery.makeCollapsible',
$modules,
'has jquery.makeCollapsible' );
59 $html = $enhancedChangesList->beginRecentChangesList();
61 $this->assertEquals(
'<div class="mw-changeslist">',
$html );
69 $enhancedChangesList->beginRecentChangesList();
72 $html = $enhancedChangesList->recentChangesLine( $recentChange,
false );
74 $this->assertInternalType(
'string',
$html );
77 $html = $enhancedChangesList->recentChangesLine( $recentChange2,
false );
79 $this->assertEquals(
'',
$html );
83 $mockContext = $this->getMockBuilder( RequestContext::class )
84 ->setMethods( [
'getTitle' ] )
86 $mockContext->method(
'getTitle' )
87 ->will( $this->returnValue( Title::newFromText(
'Expected Context Title' ) ) );
91 $enhancedChangesList->setContext( $mockContext );
92 $enhancedChangesList->setChangeLinePrefixer(
function ( $rc,
$changesList ) {
95 $this->assertTrue( $rc->getTitle() ==
'Cat' || $rc->getTitle() ==
'Dog' );
96 return 'Hello world prefix';
98 $enhancedChangesList->beginRecentChangesList();
101 $enhancedChangesList->recentChangesLine( $recentChange );
103 $enhancedChangesList->recentChangesLine( $recentChange );
105 $html = $enhancedChangesList->endRecentChangesList();
107 $this->assertRegExp(
'/Hello world prefix/',
$html );
110 $enhancedChangesList->beginRecentChangesList();
113 $enhancedChangesList->recentChangesLine( $recentChange );
114 $recentChange = $this->
getEditChange(
'20131103092154',
'Dog' );
115 $enhancedChangesList->recentChangesLine( $recentChange );
117 $html = $enhancedChangesList->endRecentChangesList();
120 $this->assertCount( 2,
$matches[0] );
127 $this->assertNotContains(
'diffhist', strip_tags(
$html ) );
134 $this->assertContains(
'diffhist', strip_tags(
$html ) );
142 $enhancedChangesList->beginRecentChangesList();
145 $enhancedChangesList->recentChangesLine( $recentChange,
false );
147 $html = $enhancedChangesList->endRecentChangesList();
149 '/data-mw-revid="5" data-mw-ts="20131103092153" class="[^"]*mw-enhanced-rc[^"]*"/',
154 $enhancedChangesList->recentChangesLine( $recentChange2,
false );
156 $html = $enhancedChangesList->endRecentChangesList();
158 preg_match_all(
'/td class="mw-enhanced-rc-nested"/',
$html,
$matches );
159 $this->assertCount( 2,
$matches[0] );
161 preg_match_all(
'/data-target-page="Cat"/',
$html,
$matches );
162 $this->assertCount( 2,
$matches[0] );
165 $enhancedChangesList->recentChangesLine( $recentChange3,
false );
167 $html = $enhancedChangesList->endRecentChangesList();
168 $this->assertContains(
'data-mw-logaction="foo/bar"',
$html );
169 $this->assertContains(
'data-mw-logid="25"',
$html );
170 $this->assertContains(
'data-target-page="Title"',
$html );
178 $context = $this->testRecentChangesHelper->getTestContext(
$user );
188 $recentChange = $this->testRecentChangesHelper->makeEditRecentChange(
189 $user, $pageTitle, 0, 5, 191, $timestamp, 0, 0
192 return $recentChange;
197 $recentChange = $this->testRecentChangesHelper->makeLogRecentChange(
'foo',
'bar',
$user,
198 'Title',
'20131103092153', 0, 0
201 return $recentChange;
208 $wikiPage =
new WikiPage( Title::newFromText(
'Testpage' ) );
209 $wikiPage->doEditContent(
new WikitextContent(
'Some random text' ),
'page created' );
211 $wikiPage =
new WikiPage( Title::newFromText(
'Category:Foo' ) );
212 $wikiPage->doEditContent(
new WikitextContent(
'Some random text' ),
'category page created' );
215 $recentChange = $this->testRecentChangesHelper->makeCategorizationRecentChange(
216 $user,
'Category:Foo', $wikiPage->getId(), $thisId, $lastId, $timestamp
219 return $recentChange;
224 $cacheEntry = $this->testRecentChangesHelper->getCacheEntry( $recentChange );
226 $reflection = new \ReflectionClass( get_class( $enhancedChangesList ) );
227 $method = $reflection->getMethod(
'recentChangesBlockLine' );
228 $method->setAccessible(
true );
230 return $method->invokeArgs( $enhancedChangesList, [ $cacheEntry ] );
getContext()
Get the base IContextSource object.
TestRecentChangesHelper $testRecentChangesHelper
testBeginRecentChangesList_html()
__construct( $name=null, array $data=[], $dataName='')
testCategorizationLineFormattingWithRevision()
createCategorizationLine( $recentChange)
testRecentChangesPrefix()
testCategorizationLineFormatting()
getEditChange( $timestamp, $pageTitle='Cat')
getCategorizationChange( $timestamp, $thisId, $lastId)
testEndRecentChangesList()
testBeginRecentChangesList_jsModules()
testBeginRecentChangesList_styleModules()
Helper for generating test recent changes entries.
static newFromId( $id)
Static factory method for creation from a given user ID.
Class representing a MediaWiki article and history.
Content object for wiki text pages.
$data
Utility to generate mapping file used in mw.Title (phpCharToUpper.json)
return true to allow those checks to and false if checking is done remove or add to the links of a group of changes in EnhancedChangesList Hook subscribers can return false to omit this line from recentchanges $changesList
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
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
Allows to change the fields on the form that will be generated $name
return true to allow those checks to and false if checking is done & $user
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
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))