wiki.techinc.nl/tests/phpunit/includes/GlobalFunctions/GlobalWithDBTest.php
addshore 4bb09bbca5 @covers for all GlobalFunc tests
Also split 2 tests off into their correct test classes,
this methods are clearly no longer global functions

Change-Id: I482433f3099e72507a766e85d9576ff36e58b9ad
2013-10-24 10:00:55 +00:00

31 lines
983 B
PHP

<?php
/**
* @group Database
*/
class GlobalWithDBTest extends MediaWikiTestCase {
/**
* @dataProvider provideWfIsBadImageList
* @covers ::wfIsBadImage
*/
public 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:' ),
);
}
}