r93471 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93470‎ | r93471 | r93472 >
Date:17:19, 29 July 2011
Author:raindrift
Status:ok
Tags:
Comment:
Added additional entry for non-automated testing
Added additional return data: raw blacklist line
switched to wfMessage from wfMsg
updated tests
followup to r92805
Modified paths:
  • /trunk/extensions/TitleBlacklist/api/ApiQueryTitleBlacklist.php (modified) (history)
  • /trunk/extensions/TitleBlacklist/tests/ApiQueryTitleBlacklistTest.php (modified) (history)
  • /trunk/extensions/TitleBlacklist/tests/testSource (modified) (history)

Diff [purge]

Index: trunk/extensions/TitleBlacklist/tests/ApiQueryTitleBlacklistTest.php
@@ -49,7 +49,13 @@
5050 $this->assertEquals(
5151 $listed[0]['titleblacklist']['reason'],
5252 "The title \"bar\" has been banned from creation.\nIt matches the following blacklist entry: <code>[Bb]ar #example blacklist entry</code>",
53 - 'Listed title error text is as as expected'
 53+ 'Listed title error text is as expected'
5454 );
 55+ $this->assertEquals(
 56+ $listed[0]['titleblacklist']['line'],
 57+ "[Bb]ar #example blacklist entry",
 58+ 'Correct blacklist line is returned'
 59+ );
 60+
5561 }
5662 }
\ No newline at end of file
Index: trunk/extensions/TitleBlacklist/tests/testSource
@@ -1 +1,2 @@
22 [Bb]ar #example blacklist entry
 3+.*[Ff]ail.*
Index: trunk/extensions/TitleBlacklist/api/ApiQueryTitleBlacklist.php
@@ -66,7 +66,9 @@
6767 );
6868
6969 $this->getResult()->addValue( 'titleblacklist', 'result', 'blacklisted' );
70 - $this->getResult()->addValue( 'titleblacklist', 'reason', wfMsg($blacklisted->getErrorMessage('edit'), $result) );
 70+ // this is hardcoded to 'edit' in Titleblacklist.hooks.php, duplicating that.
 71+ $this->getResult()->addValue( 'titleblacklist', 'reason', wfMessage( $blacklisted->getErrorMessage( 'edit' ), $result )->text() );
 72+ $this->getResult()->addValue( 'titleblacklist', 'line', htmlspecialchars( $blacklisted->getRaw() ) );
7173 } else {
7274 // not blacklisted
7375 $this->getResult()->addValue( 'titleblacklist', 'result', 'ok' );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r92805Added an API to TitleBlackList to make it possible to check the blacklist in ...raindrift22:08, 21 July 2011

Status & tagging log