diff options
author | Yaco <franco@reevo.org> | 2020-06-04 11:01:00 -0300 |
---|---|---|
committer | Yaco <franco@reevo.org> | 2020-06-04 11:01:00 -0300 |
commit | fc7369835258467bf97eb64f184b93691f9a9fd5 (patch) | |
tree | daabd60089d2dd76d9f5fb416b005fbe159c799d /www/wiki/tests/phpunit/includes/GlobalFunctions/GlobalWithDBTest.php |
first commit
Diffstat (limited to 'www/wiki/tests/phpunit/includes/GlobalFunctions/GlobalWithDBTest.php')
-rw-r--r-- | www/wiki/tests/phpunit/includes/GlobalFunctions/GlobalWithDBTest.php | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/www/wiki/tests/phpunit/includes/GlobalFunctions/GlobalWithDBTest.php b/www/wiki/tests/phpunit/includes/GlobalFunctions/GlobalWithDBTest.php new file mode 100644 index 00000000..0765ab8b --- /dev/null +++ b/www/wiki/tests/phpunit/includes/GlobalFunctions/GlobalWithDBTest.php @@ -0,0 +1,32 @@ +<?php + +/** + * @group GlobalFunctions + * @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 [ + [ 'Bad.jpg', false, $blacklist, true, + 'Called on a bad image' ], + [ 'Bad.jpg', Title::makeTitle( NS_MAIN, 'A page' ), $blacklist, true, + 'Called on a bad image' ], + [ 'NotBad.jpg', false, $blacklist, false, + 'Called on a non-bad image' ], + [ 'Bad.jpg', Title::makeTitle( NS_MAIN, 'Nasty page' ), $blacklist, false, + 'Called on a bad image but is on a whitelisted page' ], + [ 'File:Bad.jpg', false, $blacklist, false, + 'Called on a bad image with File:' ], + ]; + } +} |