Merge "DatabaseMssql: Don't duplicate body of makeList()"
[mediawiki.git] / tests / phpunit / includes / GlobalFunctions / GlobalWithDBTest.php
blob9588ffdccad47b70f8c9a45e0443d29f712769db
1 <?php
3 /**
4 * @group GlobalFunctions
5 * @group Database
6 */
7 class GlobalWithDBTest extends MediaWikiTestCase {
8 /**
9 * @dataProvider provideWfIsBadImageList
10 * @covers ::wfIsBadImage
12 public function testWfIsBadImage( $name, $title, $blacklist, $expected, $desc ) {
13 $this->assertEquals( $expected, wfIsBadImage( $name, $title, $blacklist ), $desc );
16 public static function provideWfIsBadImageList() {
17 $blacklist = '* [[File:Bad.jpg]] except [[Nasty page]]';
19 return array(
20 array( 'Bad.jpg', false, $blacklist, true,
21 'Called on a bad image' ),
22 array( 'Bad.jpg', Title::makeTitle( NS_MAIN, 'A page' ), $blacklist, true,
23 'Called on a bad image' ),
24 array( 'NotBad.jpg', false, $blacklist, false,
25 'Called on a non-bad image' ),
26 array( 'Bad.jpg', Title::makeTitle( NS_MAIN, 'Nasty page' ), $blacklist, false,
27 'Called on a bad image but is on a whitelisted page' ),
28 array( 'File:Bad.jpg', false, $blacklist, false,
29 'Called on a bad image with File:' ),