17 public function __construct( $name =
null, array $data = [], $dataName =
'' ) {
18 parent::__construct( $name, $data, $dataName );
25 $enhancedChangesList->beginRecentChangesList();
27 $styleModules = $enhancedChangesList->getOutput()->getModuleStyles();
29 $this->assertContains(
30 'mediawiki.special.changeslist',
32 'has mediawiki.special.changeslist'
35 $this->assertContains(
36 'mediawiki.special.changeslist.enhanced',
38 'has mediawiki.special.changeslist.enhanced'
44 $enhancedChangesList->beginRecentChangesList();
46 $modules = $enhancedChangesList->getOutput()->getModules();
48 $this->assertContains(
'jquery.makeCollapsible',
$modules,
'has jquery.makeCollapsible' );
49 $this->assertContains(
'mediawiki.icon',
$modules,
'has mediawiki.icon' );
54 $html = $enhancedChangesList->beginRecentChangesList();
56 $this->assertEquals(
'<div class="mw-changeslist">',
$html );
64 $enhancedChangesList->beginRecentChangesList();
67 $html = $enhancedChangesList->recentChangesLine( $recentChange,
false );
69 $this->assertInternalType(
'string',
$html );
72 $html = $enhancedChangesList->recentChangesLine( $recentChange2,
false );
74 $this->assertEquals(
'',
$html );
78 $mockContext = $this->getMockBuilder( RequestContext::class )
79 ->setMethods( [
'getTitle' ] )
81 $mockContext->method(
'getTitle' )
82 ->will( $this->returnValue( Title::newFromText(
'Expected Context Title' ) ) );
86 $enhancedChangesList->setContext( $mockContext );
87 $enhancedChangesList->setChangeLinePrefixer(
function ( $rc,
$changesList ) {
89 $this->assertEquals(
'Expected Context Title',
$changesList->getContext()->getTitle() );
90 $this->assertTrue( $rc->getTitle() ==
'Cat' || $rc->getTitle() ==
'Dog' );
91 return 'Hello world prefix';
93 $enhancedChangesList->beginRecentChangesList();
96 $enhancedChangesList->recentChangesLine( $recentChange );
98 $enhancedChangesList->recentChangesLine( $recentChange );
100 $html = $enhancedChangesList->endRecentChangesList();
102 $this->assertRegExp(
'/Hello world prefix/',
$html );
105 $enhancedChangesList->beginRecentChangesList();
108 $enhancedChangesList->recentChangesLine( $recentChange );
109 $recentChange = $this->
getEditChange(
'20131103092154',
'Dog' );
110 $enhancedChangesList->recentChangesLine( $recentChange );
112 $html = $enhancedChangesList->endRecentChangesList();
115 $this->assertCount( 2,
$matches[0] );
122 $this->assertNotContains(
'(diff | hist)', strip_tags(
$html ) );
129 $this->assertContains(
'(diff | hist)', strip_tags(
$html ) );
137 $enhancedChangesList->beginRecentChangesList();
140 $enhancedChangesList->recentChangesLine( $recentChange,
false );
142 $html = $enhancedChangesList->endRecentChangesList();
144 '/data-mw-revid="5" data-mw-ts="20131103092153" class="[^"]*mw-enhanced-rc[^"]*"/',
149 $enhancedChangesList->recentChangesLine( $recentChange2,
false );
151 $html = $enhancedChangesList->endRecentChangesList();
153 preg_match_all(
'/td class="mw-enhanced-rc-nested"/',
$html,
$matches );
154 $this->assertCount( 2,
$matches[0] );
156 preg_match_all(
'/data-target-page="Cat"/',
$html,
$matches );
157 $this->assertCount( 2,
$matches[0] );
160 $enhancedChangesList->recentChangesLine( $recentChange3,
false );
162 $html = $enhancedChangesList->endRecentChangesList();
163 $this->assertContains(
'data-mw-logaction="foo/bar"',
$html );
164 $this->assertContains(
'data-mw-logid="25"',
$html );
165 $this->assertContains(
'data-target-page="Title"',
$html );
173 $context = $this->testRecentChangesHelper->getTestContext( $user );
183 $recentChange = $this->testRecentChangesHelper->makeEditRecentChange(
184 $user, $pageTitle, 0, 5, 191, $timestamp, 0, 0
187 return $recentChange;
192 $recentChange = $this->testRecentChangesHelper->makeLogRecentChange(
'foo',
'bar', $user,
193 'Title',
'20131103092153', 0, 0
196 return $recentChange;
203 $wikiPage =
new WikiPage( Title::newFromText(
'Testpage' ) );
204 $wikiPage->doEditContent(
new WikitextContent(
'Some random text' ),
'page created' );
206 $wikiPage =
new WikiPage( Title::newFromText(
'Category:Foo' ) );
207 $wikiPage->doEditContent(
new WikitextContent(
'Some random text' ),
'category page created' );
210 $recentChange = $this->testRecentChangesHelper->makeCategorizationRecentChange(
211 $user,
'Category:Foo', $wikiPage->getId(), $thisId, $lastId, $timestamp
214 return $recentChange;
219 $cacheEntry = $this->testRecentChangesHelper->getCacheEntry( $recentChange );
221 $reflection = new \ReflectionClass( get_class( $enhancedChangesList ) );
222 $method = $reflection->getMethod(
'recentChangesBlockLine' );
223 $method->setAccessible(
true );
225 return $method->invokeArgs( $enhancedChangesList, [ $cacheEntry ] );
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.
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