/**
* @covers OldChangesList
*
+ * @todo add tests to cover article link, timestamp, character difference,
+ * log entry, user tool links, direction marks, tags, rollback,
+ * watching users, and date header.
+ *
* @group Database
*
* @licence GNU GPL v2+
parent::setUp();
$this->setMwGlobals( array(
- 'wgArticlePath' => '/wiki/$1'
+ 'wgArticlePath' => '/wiki/$1',
+ 'wgLang' => Language::factory( 'qqx' )
) );
}
public function testRecentChangesLine_LogTitle() {
$oldChangesList = $this->getOldChangesList();
- $recentChange = $this->getLogChange( 'delete' );
+ $recentChange = $this->getLogChange( 'delete', 'delete' );
$line = $oldChangesList->recentChangesLine( $recentChange, false, 1 );
- $message = new Message( 'dellogpage' );
- $expectedLinkText = $message->inLanguage( 'en' )->text();
-
$this->assertRegExp( '/href="\/wiki\/Special:Log\/delete/', $line, 'link has href attribute' );
$this->assertRegExp( '/title="Special:Log\/delete/', $line, 'link has title attribute' );
- $this->assertRegExp( "/$expectedLinkText/", $line, 'link text' );
+ $this->assertRegExp( "/dellogpage/", $line, 'link text' );
}
public function testRecentChangesLine_DiffHistLinks() {
);
}
+ public function testRecentChangesLine_Flags() {
+ $oldChangesList = $this->getOldChangesList();
+ $recentChange = $this->getNewBotEditChange();
+
+ $line = $oldChangesList->recentChangesLine( $recentChange, false, 1 );
+
+ $this->assertContains(
+ "<abbr class='newpage' title='(recentchanges-label-newpage)'>(newpageletter)</abbr>",
+ $line,
+ 'new page flag'
+ );
+
+ $this->assertContains(
+ "<abbr class='botedit' title='(recentchanges-label-bot)'>(boteditletter)</abbr>",
+ $line,
+ 'bot flag'
+ );
+ }
+
+ public function testRecentChangesLine_Tags() {
+ $recentChange = $this->getEditChange();
+ $recentChange->mAttribs['ts_tags'] = 'vandalism,newbie';
+
+ $oldChangesList = $this->getOldChangesList();
+ $line = $oldChangesList->recentChangesLine( $recentChange, false, 1 );
+
+ $this->assertRegExp( '/<li class="[\w\s-]*mw-tag-vandalism[\w\s-]*">/', $line );
+ $this->assertRegExp( '/<li class="[\w\s-]*mw-tag-newbie[\w\s-]*">/', $line );
+ }
+
private function getNewBotEditChange() {
$user = $this->getTestUser();
$recentChange = $this->testRecentChangesHelper->makeNewBotEditRecentChange(
- $user, 'Abc', '20131103212153', 0, 0
+ $user, 'Abc', '20131103212153', 5, 191, 190, 0, 0
);
return $recentChange;
}
- private function getLogChange( $logType ) {
+ private function getLogChange( $logType, $logAction ) {
$user = $this->getTestUser();
$recentChange = $this->testRecentChangesHelper->makeLogRecentChange(
- $logType, $user, 'Abc', '20131103212153', 0, 0
+ $logType, $logAction, $user, 'Abc', '20131103212153', 0, 0
);
return $recentChange;
private function getContext() {
$user = $this->getTestUser();
$context = $this->testRecentChangesHelper->getTestContext( $user );
-
- $title = Title::newFromText( 'RecentChanges', NS_SPECIAL );
- $context->setTitle( $title );
+ $context->setLanguage( Language::factory( 'qqx' ) );
return $context;
}