The name change happened some time ago, and I think its about time to start using the name name! (Done with a find and replace) My personal motivation for doing this is that I have started trying out vscode as an IDE for mediawiki development, and right now it doesn't appear to handle php aliases very well or at all. Change-Id: I412235d91ae26e4c1c6a62e0dbb7e7cf3c5ed4a6
48 lines
1.5 KiB
PHP
48 lines
1.5 KiB
PHP
<?php
|
|
|
|
use MediaWiki\MediaWikiServices;
|
|
|
|
/**
|
|
* @group GlobalFunctions
|
|
* @group Database
|
|
*/
|
|
class GlobalWithDBTest extends MediaWikiIntegrationTestCase {
|
|
private function setUpBadImageTests( $name ) {
|
|
if ( in_array( $name, [
|
|
'Hook bad.jpg',
|
|
'Redirect to bad.jpg',
|
|
'Redirect_to_good.jpg',
|
|
'Redirect to hook bad.jpg',
|
|
'Redirect to hook good.jpg',
|
|
] ) ) {
|
|
$this->markTestSkipped( "Didn't get RepoGroup working properly yet" );
|
|
}
|
|
|
|
// Don't try to fetch the files from Commons or anything, please
|
|
$this->setMwGlobals( 'wgForeignFileRepos', [] );
|
|
|
|
// XXX How do we get file redirects to work?
|
|
$this->editPage( 'File:Redirect to bad.jpg', '#REDIRECT [[Bad.jpg]]' );
|
|
$this->editPage( 'File:Redirect to good.jpg', '#REDIRECT [[Good.jpg]]' );
|
|
$this->editPage( 'File:Redirect to hook bad.jpg', '#REDIRECT [[Hook bad.jpg]]' );
|
|
$this->editPage( 'File:Redirect to hook good.jpg', '#REDIRECT [[Hook good.jpg]]' );
|
|
|
|
$this->setTemporaryHook( 'BadImage', 'BadFileLookupTest::badImageHook' );
|
|
}
|
|
|
|
/**
|
|
* @dataProvider BadFileLookupTest::provideIsBadFile
|
|
* @covers ::wfIsBadImage
|
|
*/
|
|
public function testWfIsBadImage( $name, $title, $expected ) {
|
|
$this->setUpBadImageTests( $name );
|
|
|
|
$this->editPage( 'MediaWiki:Bad image list', BadFileLookupTest::BAD_FILE_LIST );
|
|
$this->resetServices();
|
|
// Enable messages from MediaWiki namespace
|
|
MediaWikiServices::getInstance()->getMessageCache()->enable();
|
|
|
|
$this->hideDeprecated( 'wfIsBadImage' );
|
|
$this->assertEquals( $expected, wfIsBadImage( $name, $title ) );
|
|
}
|
|
}
|