MediaWiki REL1_31
GlobalWithDBTest.php
Go to the documentation of this file.
1<?php
2
12 public function testWfIsBadImage( $name, $title, $blacklist, $expected, $desc ) {
13 $this->assertEquals( $expected, wfIsBadImage( $name, $title, $blacklist ), $desc );
14 }
15
16 public static function provideWfIsBadImageList() {
17 $blacklist = '* [[File:Bad.jpg]] except [[Nasty page]]';
18
19 return [
20 [ 'Bad.jpg', false, $blacklist, true,
21 'Called on a bad image' ],
22 [ 'Bad.jpg', Title::makeTitle( NS_MAIN, 'A page' ), $blacklist, true,
23 'Called on a bad image' ],
24 [ 'NotBad.jpg', false, $blacklist, false,
25 'Called on a non-bad image' ],
26 [ 'Bad.jpg', Title::makeTitle( NS_MAIN, 'Nasty page' ), $blacklist, false,
27 'Called on a bad image but is on a whitelisted page' ],
28 [ 'File:Bad.jpg', false, $blacklist, false,
29 'Called on a bad image with File:' ],
30 ];
31 }
32}
wfIsBadImage( $name, $contextTitle=false, $blacklist=null)
Determine if an image exists on the 'bad image list'.
GlobalFunctions Database.
testWfIsBadImage( $name, $title, $blacklist, $expected, $desc)
provideWfIsBadImageList wfIsBadImage
static provideWfIsBadImageList()
const NS_MAIN
Definition Defines.php:74