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 );
84 ->setMethods( [
'getTitle' ] )
86 $mockContext->method(
'getTitle' )
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;
209 $wikiPage->doEditContent(
new WikitextContent(
'Some random text' ),
'page created' );
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 ] );