4 * @group GlobalFunctions
7 class GlobalWithDBTest
extends MediaWikiTestCase
{
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]]';
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:' ),