Merge "FormatJson: Remove whitespace from empty arrays and objects"
[lhc/web/wiklou.git] / tests / phpunit / includes / GlobalFunctions / GlobalWithDBTest.php
1 <?php
2
3 /**
4 * @group Database
5 */
6 class GlobalWithDBTest extends MediaWikiTestCase {
7 /**
8 * @dataProvider provideWfIsBadImageList
9 * @covers ::wfIsBadImage
10 */
11 public function testWfIsBadImage( $name, $title, $blacklist, $expected, $desc ) {
12 $this->assertEquals( $expected, wfIsBadImage( $name, $title, $blacklist ), $desc );
13 }
14
15 public static function provideWfIsBadImageList() {
16 $blacklist = '* [[File:Bad.jpg]] except [[Nasty page]]';
17
18 return array(
19 array( 'Bad.jpg', false, $blacklist, true,
20 'Called on a bad image' ),
21 array( 'Bad.jpg', Title::makeTitle( NS_MAIN, 'A page' ), $blacklist, true,
22 'Called on a bad image' ),
23 array( 'NotBad.jpg', false, $blacklist, false,
24 'Called on a non-bad image' ),
25 array( 'Bad.jpg', Title::makeTitle( NS_MAIN, 'Nasty page' ), $blacklist, false,
26 'Called on a bad image but is on a whitelisted page' ),
27 array( 'File:Bad.jpg', false, $blacklist, false,
28 'Called on a bad image with File:' ),
29 );
30 }
31 }