Merge "Update docs/hooks.txt for ShowSearchHitTitle"
[mediawiki.git] / tests / phpunit / includes / GlobalFunctions / GlobalWithDBTest.php
blob0765ab8b4d644cb98b50c4045e5479062c63e543
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 [
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:' ],