6 class GlobalWithDBTest
extends MediaWikiTestCase
{
8 * @dataProvider provideWfIsBadImageList
9 * @covers ::wfIsBadImage
11 public function testWfIsBadImage( $name, $title, $blacklist, $expected, $desc ) {
12 $this->assertEquals( $expected, wfIsBadImage( $name, $title, $blacklist ), $desc );
15 public static function provideWfIsBadImageList() {
16 $blacklist = '* [[File:Bad.jpg]] except [[Nasty page]]';
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:' ),