Index: trunk/extensions/TitleBlacklist/tests/ApiQueryTitleBlacklistTest.php |
— | — | @@ -49,7 +49,13 @@ |
50 | 50 | $this->assertEquals( |
51 | 51 | $listed[0]['titleblacklist']['reason'], |
52 | 52 | "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' |
54 | 54 | ); |
| 55 | + $this->assertEquals( |
| 56 | + $listed[0]['titleblacklist']['line'], |
| 57 | + "[Bb]ar #example blacklist entry", |
| 58 | + 'Correct blacklist line is returned' |
| 59 | + ); |
| 60 | + |
55 | 61 | } |
56 | 62 | } |
\ No newline at end of file |
Index: trunk/extensions/TitleBlacklist/tests/testSource |
— | — | @@ -1 +1,2 @@ |
2 | 2 | [Bb]ar #example blacklist entry |
| 3 | +.*[Ff]ail.* |
Index: trunk/extensions/TitleBlacklist/api/ApiQueryTitleBlacklist.php |
— | — | @@ -66,7 +66,9 @@ |
67 | 67 | ); |
68 | 68 | |
69 | 69 | $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() ) ); |
71 | 73 | } else { |
72 | 74 | // not blacklisted |
73 | 75 | $this->getResult()->addValue( 'titleblacklist', 'result', 'ok' ); |