wiki.techinc.nl/tests/phpunit/includes/GlobalFunctions/GlobalWithDBTest.php
Timo Tijhof b36d883017 Tests: Make phpunit providers "public static".
Follows-up I9d2b148e57 (including phpunit/languages this time).

Bug: 46434
Change-Id: I30e5efcd88c516121c454676bd7a18f9b7c8fca6
2013-03-22 03:12:37 +01:00

29 lines
948 B
PHP

<?php
/**
* @group Database
*/
class GlobalWithDBTest extends MediaWikiTestCase {
/**
* @dataProvider provideWfIsBadImageList
*/
function testWfIsBadImage( $name, $title, $blacklist, $expected, $desc ) {
$this->assertEquals( $expected, wfIsBadImage( $name, $title, $blacklist ), $desc );
}
public static function provideWfIsBadImageList() {
$blacklist = '* [[File:Bad.jpg]] except [[Nasty page]]';
return array(
array( 'Bad.jpg', false, $blacklist, true,
'Called on a bad image' ),
array( 'Bad.jpg', Title::makeTitle( NS_MAIN, 'A page' ), $blacklist, true,
'Called on a bad image' ),
array( 'NotBad.jpg', false, $blacklist, false,
'Called on a non-bad image' ),
array( 'Bad.jpg', Title::makeTitle( NS_MAIN, 'Nasty page' ), $blacklist, false,
'Called on a bad image but is on a whitelisted page' ),
array( 'File:Bad.jpg', false, $blacklist, false,
'Called on a bad image with File:' ),
);
}
}