Merge branch 'REL1_41' of https://git.qiuwen.net.cn/Mirror/mediawiki-extensions-CommonsMetadata into REL1_41
Signed-off-by: WaitSpring <me@waitspring.com>
这个提交包含在:
当前提交
e4131be0de
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"require-dev": {
|
||||
"mediawiki/mediawiki-codesniffer": "39.0.0",
|
||||
"mediawiki/mediawiki-phan-config": "0.12.0",
|
||||
"mediawiki/mediawiki-codesniffer": "41.0.0",
|
||||
"mediawiki/mediawiki-phan-config": "0.12.1",
|
||||
"mediawiki/minus-x": "1.1.1",
|
||||
"php-parallel-lint/php-console-highlighter": "1.0.0",
|
||||
"php-parallel-lint/php-parallel-lint": "1.3.2"
|
||||
|
|
|
@ -6,13 +6,18 @@
|
|||
"license-name": "GPL-2.0-or-later",
|
||||
"type": "other",
|
||||
"requires": {
|
||||
"MediaWiki": ">= 1.38.0"
|
||||
"MediaWiki": ">= 1.41"
|
||||
},
|
||||
"Hooks": {
|
||||
"GetExtendedMetadata": "CommonsMetadata\\HookHandler::onGetExtendedMetadata",
|
||||
"ValidateExtendedMetadataCache": "CommonsMetadata\\HookHandler::onValidateExtendedMetadataCache",
|
||||
"ContentAlterParserOutput": "CommonsMetadata\\HookHandler::onContentAlterParserOutput",
|
||||
"SkinAfterBottomScripts": "CommonsMetadata\\HookHandler::onSkinAfterBottomScripts"
|
||||
"GetExtendedMetadata": "main",
|
||||
"ValidateExtendedMetadataCache": "main",
|
||||
"ContentAlterParserOutput": "main",
|
||||
"SkinAfterBottomScripts": "main"
|
||||
},
|
||||
"HookHandlers": {
|
||||
"main": {
|
||||
"class": "CommonsMetadata\\HookHandler"
|
||||
}
|
||||
},
|
||||
"MessagesDirs": {
|
||||
"CommonsMetadata": [
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
"@metadata": {
|
||||
"authors": [
|
||||
"Айбикә",
|
||||
"Рустам Нурыев",
|
||||
"З. ӘЙЛЕ"
|
||||
"З. ӘЙЛЕ",
|
||||
"Рустам Нурыев"
|
||||
]
|
||||
},
|
||||
"commonsmetadata-desc": "Викимилектәге ҡалыптар йыш ҡулланған, һүрәтләү биттәрендә һаҡланған мәғлүмәтте индереү өсөн \"extmetadata\" һүрәтләү үҙенсәлеген API-модулгә ебәрә",
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
"@metadata": {
|
||||
"authors": [
|
||||
"Aftabuzzaman",
|
||||
"আফতাবুজ্জামান",
|
||||
"Tahmid"
|
||||
"Tahmid",
|
||||
"আফতাবুজ্জামান"
|
||||
]
|
||||
},
|
||||
"commonsmetadata-desc": "ছবি বর্ণনা পাতায় সঞ্চিত তথ্য অন্তর্ভুক্ত করতে চিত্রের তথ্য এপিআই মডিউলের \"extmetadata\" বৈশিষ্ট্য প্রসারিত করে যা সাধারণভাবে উইকিমিডিয়া কমন্সে ব্যবহার করা টেমপ্লেটে ব্যবহার করা হয়",
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
{
|
||||
"@metadata": {
|
||||
"authors": [
|
||||
"Chase me ladies, I'm the Cavalry"
|
||||
"Chase me ladies, I'm the Cavalry",
|
||||
"Piano1forte2"
|
||||
]
|
||||
},
|
||||
"commonsmetadata-trackingcategory-no-license": "Files with no machine-readable licence",
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"@metadata": {
|
||||
"authors": [
|
||||
"Akakiiri",
|
||||
"Baba Ayɛ'ɛra"
|
||||
"Baba Ayɛ'ɛra",
|
||||
"Akakiiri"
|
||||
]
|
||||
},
|
||||
"commonsmetadata-desc": "Ba malum vurege \"extimatadata\" foote lɔgerɔ yɛla yelesum n de API lɔkɔ tole nɛŋa la yelesum sebo n pa'alɛ foote la pɛgera n doose se'em dee zo'e zo'e puan ti a bɔna Wikimedia fɔɔra zi'an la",
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
"Kwj2772",
|
||||
"Namoroka",
|
||||
"Priviet",
|
||||
"아라",
|
||||
"Ykhwong"
|
||||
"Ykhwong",
|
||||
"아라"
|
||||
]
|
||||
},
|
||||
"commonsmetadata-desc": "그림 정보 API 모듈의 \"extmetadata\" 속성을, 위키미디어 공용에서 공용으로 사용되는 틀을 사용하는 그림 설명 문서에 담긴 정보를 포함하도록 확장합니다",
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"@metadata": {
|
||||
"authors": [
|
||||
"Msz2001",
|
||||
"WTM",
|
||||
"Woytecr",
|
||||
"Msz2001"
|
||||
|
|
18
i18n/sh.json
18
i18n/sh.json
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"@metadata": {
|
||||
"authors": [
|
||||
"Vlad5250"
|
||||
]
|
||||
},
|
||||
"commonsmetadata-desc": "Proširuje osobinu za informiranje „extmetadata“ u API-modul sa informacijama što stoje na opisnima stranicama slika koje koriste šabloni zastupljeni na Ostavi",
|
||||
"commonsmetadata-trackingcategory-no-license": "Datoteke bez mašinski čitljive licence",
|
||||
"commonsmetadata-trackingcategory-no-license-desc": "Ova datoteka nema [{{MediaWiki:Commonsmetadata-doc-url}} mašinski čitljiv] licencni šablon.",
|
||||
"commonsmetadata-trackingcategory-no-description": "Datoteke bez mašinski čitljivog opisa",
|
||||
"commonsmetadata-trackingcategory-no-description-desc": "Ova datoteka nema [{{MediaWiki:Commonsmetadata-doc-url}} mašinski čitljiv] informativni šablon ili pak nije mu popunjeno polje opis.",
|
||||
"commonsmetadata-trackingcategory-no-author": "Datoteke bez mašinski čitljivog autora",
|
||||
"commonsmetadata-trackingcategory-no-author-desc": "Ova datoteka nema [{{MediaWiki:Commonsmetadata-doc-url}} mašinski čitljiv] informativni šablon ili pak nije mu popunjeno polje autor.",
|
||||
"commonsmetadata-trackingcategory-no-source": "Datoteke bez mašinski čitljivog izvora",
|
||||
"commonsmetadata-trackingcategory-no-source-desc": "Ova datoteka nema [{{MediaWiki:Commonsmetadata-doc-url}} mašinski čitljiv] informativni šablon ili pak nije mu popunjeno polje izvor.",
|
||||
"commonsmetadata-trackingcategory-no-patent": "Datoteke bez mašinski čitljivog patenta",
|
||||
"commonsmetadata-trackingcategory-no-patent-desc": "Ova datoteka nema [{{MediaWiki:Commonsmetadata-doc-url}} mašinski čitljiv] patentni šablon."
|
||||
}
|
文件差异内容过多而无法显示
加载差异
12
package.json
12
package.json
|
@ -5,11 +5,11 @@
|
|||
"test": "grunt test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint-config-wikimedia": "0.22.1",
|
||||
"grunt": "1.5.3",
|
||||
"grunt-banana-checker": "0.10.0",
|
||||
"grunt-eslint": "24.0.0",
|
||||
"grunt-stylelint": "0.17.0",
|
||||
"stylelint-config-wikimedia": "0.13.0"
|
||||
"eslint-config-wikimedia": "0.25.0",
|
||||
"grunt": "1.6.1",
|
||||
"grunt-banana-checker": "0.11.0",
|
||||
"grunt-eslint": "24.0.1",
|
||||
"grunt-stylelint": "0.18.0",
|
||||
"stylelint-config-wikimedia": "0.15.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,10 +4,10 @@ namespace CommonsMetadata;
|
|||
|
||||
use File;
|
||||
use ForeignAPIFile;
|
||||
use InvalidArgumentException;
|
||||
use Language;
|
||||
use LocalFile;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MWException;
|
||||
use ParserOutput;
|
||||
use WikiFilePage;
|
||||
|
||||
|
@ -286,8 +286,10 @@ class DataCollector {
|
|||
|
||||
$page = MediaWikiServices::getInstance()->getWikiPageFactory()->newFromTitle( $file->getOriginalTitle() );
|
||||
if ( !$page instanceof WikiFilePage ) {
|
||||
throw new MWException( 'Cannot instance WikiFilePage to get categories for ' . $file->getName()
|
||||
. ', got instance of ' . get_class( $page ) );
|
||||
throw new InvalidArgumentException(
|
||||
'Cannot instance WikiFilePage to get categories for ' . $file->getName()
|
||||
. ', got instance of ' . get_class( $page )
|
||||
);
|
||||
}
|
||||
$page->setFile( $file );
|
||||
|
||||
|
|
|
@ -23,16 +23,13 @@ class DomNavigator {
|
|||
* @param string $html
|
||||
*/
|
||||
public function __construct( $html ) {
|
||||
// libxml mutilates UTF-8 chars unless they are encoded as entities
|
||||
$html = mb_convert_encoding( $html, 'HTML-ENTITIES', 'UTF-8' );
|
||||
|
||||
$oldLoaderState = false;
|
||||
if ( LIBXML_VERSION < 20900 ) {
|
||||
$oldLoaderState = libxml_disable_entity_loader( true );
|
||||
}
|
||||
$oldHandlerState = libxml_use_internal_errors( true );
|
||||
$dom = new DOMDocument();
|
||||
$dom->loadHTML( $html );
|
||||
$dom->loadHTML( '<!doctype html><html><head><meta charset="UTF-8"/></head><body>' . $html . '</body></html>' );
|
||||
$this->domx = new DOMXPath( $dom );
|
||||
if ( LIBXML_VERSION < 20900 ) {
|
||||
libxml_disable_entity_loader( $oldLoaderState );
|
||||
|
|
|
@ -10,15 +10,24 @@ use FormatMetadata;
|
|||
use IContextSource;
|
||||
use Language;
|
||||
use LocalRepo;
|
||||
use MediaWiki\Content\Hook\ContentAlterParserOutputHook;
|
||||
use MediaWiki\Hook\GetExtendedMetadataHook;
|
||||
use MediaWiki\Hook\SkinAfterBottomScriptsHook;
|
||||
use MediaWiki\Hook\ValidateExtendedMetadataCacheHook;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\Title\Title;
|
||||
use ParserOutput;
|
||||
use Skin;
|
||||
use Title;
|
||||
|
||||
/**
|
||||
* Hook handler
|
||||
*/
|
||||
class HookHandler {
|
||||
class HookHandler implements
|
||||
GetExtendedMetadataHook,
|
||||
ValidateExtendedMetadataCacheHook,
|
||||
ContentAlterParserOutputHook,
|
||||
SkinAfterBottomScriptsHook
|
||||
{
|
||||
/**
|
||||
* Metadata version. When getting metadata of a remote file via the API, sometimes
|
||||
* we get the data generated by a CommonsMetadata extension installed at the remote,
|
||||
|
@ -36,10 +45,9 @@ class HookHandler {
|
|||
* @param IContextSource $context Context. Used to select language
|
||||
* @param bool $singleLang Get only target language, or all translations
|
||||
* @param int &$maxCache How many seconds to cache the result
|
||||
* @return bool This hook handler always returns true
|
||||
*/
|
||||
public static function onGetExtendedMetadata(
|
||||
&$combinedMeta, File $file, IContextSource $context, $singleLang, &$maxCache
|
||||
public function onGetExtendedMetadata(
|
||||
&$combinedMeta, $file, $context, $singleLang, &$maxCache
|
||||
) {
|
||||
global $wgCommonsMetadataForceRecalculate;
|
||||
|
||||
|
@ -50,7 +58,7 @@ class HookHandler {
|
|||
) {
|
||||
// This is a file from a remote API repo, and CommonsMetadata is installed on
|
||||
// the remote as well, and generates the same metadata format. We have nothing to do.
|
||||
return true;
|
||||
return;
|
||||
} else {
|
||||
$combinedMeta['CommonsMetadataExtension'] = [
|
||||
'value' => self::VERSION,
|
||||
|
@ -62,7 +70,7 @@ class HookHandler {
|
|||
|
||||
$templateParser = new TemplateParser();
|
||||
$templateParser->setMultiLanguage( !$singleLang );
|
||||
$fallbacks = Language::getFallbacksFor( $lang->getCode() );
|
||||
$fallbacks = MediaWikiServices::getInstance()->getLanguageFallback()->getAll( $lang->getCode() );
|
||||
array_unshift( $fallbacks, $lang->getCode() );
|
||||
$templateParser->setPriorityLanguages( $fallbacks );
|
||||
|
||||
|
@ -79,8 +87,6 @@ class HookHandler {
|
|||
// If that's the case, just cache blindly for a shorter period.
|
||||
$maxCache = 60 * 60 * 12;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -90,7 +96,7 @@ class HookHandler {
|
|||
* @param File $file The file metadata is for
|
||||
* @return bool Is metadata still valid
|
||||
*/
|
||||
public static function onValidateExtendedMetadataCache( $timestamp, File $file ) {
|
||||
public function onValidateExtendedMetadataCache( $timestamp, $file ) {
|
||||
return // use cached value if...
|
||||
// we don't know when the file was last updated
|
||||
!$file->getDescriptionTouched()
|
||||
|
@ -105,10 +111,9 @@ class HookHandler {
|
|||
* @param Content $content
|
||||
* @param Title $title
|
||||
* @param ParserOutput $parserOutput
|
||||
* @return bool this hook handler always returns true.
|
||||
*/
|
||||
public static function onContentAlterParserOutput(
|
||||
Content $content, Title $title, ParserOutput $parserOutput
|
||||
public function onContentAlterParserOutput(
|
||||
$content, $title, $parserOutput
|
||||
) {
|
||||
global $wgCommonsMetadataSetTrackingCategories;
|
||||
|
||||
|
@ -118,7 +123,7 @@ class HookHandler {
|
|||
|| !$parserOutput->hasText()
|
||||
|| $content->getModel() !== CONTENT_MODEL_WIKITEXT
|
||||
) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -137,13 +142,13 @@ class HookHandler {
|
|||
$trackingCategories = $services->getTrackingCategories();
|
||||
$repo = $services->getRepoGroup()->getLocalRepo();
|
||||
if ( $title->isRedirect() ) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
$file = $repo->findFile( $title, [ 'ignoreRedirect' => true ] );
|
||||
if ( $file === false ) {
|
||||
$file = $repo->findFile( $title, [ 'ignoreRedirect' => true, 'latest' => true ] );
|
||||
if ( $file === false ) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -158,8 +163,6 @@ class HookHandler {
|
|||
$title
|
||||
);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -170,7 +173,7 @@ class HookHandler {
|
|||
private static function getDataCollector( Language $lang, $singleLang ) {
|
||||
$templateParser = new TemplateParser();
|
||||
$templateParser->setMultiLanguage( !$singleLang );
|
||||
$fallbacks = Language::getFallbacksFor( $lang->getCode() );
|
||||
$fallbacks = MediaWikiServices::getInstance()->getLanguageFallback()->getAll( $lang->getCode() );
|
||||
array_unshift( $fallbacks, $lang->getCode() );
|
||||
$templateParser->setPriorityLanguages( $fallbacks );
|
||||
|
||||
|
@ -191,10 +194,8 @@ class HookHandler {
|
|||
*
|
||||
* @param Skin $skin
|
||||
* @param string &$html
|
||||
*
|
||||
* @return bool Always true.
|
||||
*/
|
||||
public static function onSkinAfterBottomScripts( Skin $skin, &$html ) {
|
||||
public function onSkinAfterBottomScripts( $skin, &$html ) {
|
||||
$title = $skin->getOutput()->getTitle();
|
||||
$isFilePage = $title->inNamespace( NS_FILE );
|
||||
|
||||
|
@ -203,7 +204,7 @@ class HookHandler {
|
|||
!$title->exists() ||
|
||||
!$isFilePage
|
||||
) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
$localRepo = MediaWikiServices::getInstance()->getRepoGroup()->getLocalRepo();
|
||||
|
@ -222,14 +223,11 @@ class HookHandler {
|
|||
|
||||
$handler = new SkinAfterBottomScriptsHandler( $format, $publicDomainPageUrl );
|
||||
|
||||
$hooksObject = new self();
|
||||
$html .= $hooksObject->doSkinAfterBottomScripts(
|
||||
$html .= $this->doSkinAfterBottomScripts(
|
||||
$localRepo,
|
||||
$handler,
|
||||
$title
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace CommonsMetadata\Hooks;
|
|||
use File;
|
||||
use FormatMetadata;
|
||||
use Html;
|
||||
use Title;
|
||||
use MediaWiki\Title\Title;
|
||||
|
||||
/**
|
||||
* @license GPL-2.0-or-later
|
||||
|
|
|
@ -4,9 +4,9 @@ namespace CommonsMetadata;
|
|||
|
||||
use File;
|
||||
use Language;
|
||||
use MediaWiki\Title\Title;
|
||||
use ParserOutput;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Title;
|
||||
|
||||
/**
|
||||
* @group Database
|
||||
|
|
|
@ -5,8 +5,8 @@ namespace CommonsMetadata;
|
|||
use CommonsMetadata\Hooks\SkinAfterBottomScriptsHandler;
|
||||
use File;
|
||||
use LocalRepo;
|
||||
use MediaWiki\Title\Title;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Title;
|
||||
|
||||
require_once __DIR__ . "/ParserTestHelper.php";
|
||||
|
||||
|
@ -33,7 +33,7 @@ class HookHandlerTest extends TestCase {
|
|||
$file = $this->parserTestHelper->getLocalFile( $description, $categories );
|
||||
$context = $this->parserTestHelper->getContext( 'en' );
|
||||
|
||||
HookHandler::onGetExtendedMetadata( $metadata, $file, $context, true, $maxCache );
|
||||
( new HookHandler )->onGetExtendedMetadata( $metadata, $file, $context, true, $maxCache );
|
||||
|
||||
// cache interval was not changed
|
||||
$this->assertEquals( 3600, $maxCache );
|
||||
|
@ -53,7 +53,7 @@ class HookHandlerTest extends TestCase {
|
|||
$file = $this->parserTestHelper->getForeignApiFile( $description );
|
||||
$context = $this->parserTestHelper->getContext( 'en' );
|
||||
|
||||
HookHandler::onGetExtendedMetadata( $metadata, $file, $context, true, $maxCache );
|
||||
( new HookHandler )->onGetExtendedMetadata( $metadata, $file, $context, true, $maxCache );
|
||||
|
||||
// cache interval was not changed
|
||||
$this->assertEquals( 3600, $maxCache );
|
||||
|
@ -74,7 +74,7 @@ class HookHandlerTest extends TestCase {
|
|||
$file = $this->parserTestHelper->getForeignDbFile( $description, $categories );
|
||||
$context = $this->parserTestHelper->getContext( 'en' );
|
||||
|
||||
HookHandler::onGetExtendedMetadata( $metadata, $file, $context, true, $maxCache );
|
||||
( new HookHandler )->onGetExtendedMetadata( $metadata, $file, $context, true, $maxCache );
|
||||
|
||||
// cache interval is 12 hours for all remote files
|
||||
$this->assertEquals( 3600 * 12, $maxCache );
|
||||
|
@ -98,7 +98,7 @@ class HookHandlerTest extends TestCase {
|
|||
$file = $this->parserTestHelper->getLocalFile( $description, [] );
|
||||
$context = $this->parserTestHelper->getContext( 'en' );
|
||||
|
||||
HookHandler::onGetExtendedMetadata( $actualMetadata, $file, $context, true, $maxCache );
|
||||
( new HookHandler )->onGetExtendedMetadata( $actualMetadata, $file, $context, true, $maxCache );
|
||||
|
||||
$expectedMetadata = $this->parserTestHelper->getMetadata( $testName );
|
||||
foreach ( $expectedMetadata as $key => $val ) {
|
||||
|
@ -108,7 +108,7 @@ class HookHandlerTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
public function provideDescriptionData() {
|
||||
public static function provideDescriptionData() {
|
||||
return [
|
||||
[ 'noinfo' ],
|
||||
[ 'simple' ],
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace CommonsMetadata\Hooks;
|
|||
|
||||
use File;
|
||||
use FormatMetadata;
|
||||
use Title;
|
||||
use MediaWiki\Title\Title;
|
||||
|
||||
/**
|
||||
* @covers \CommonsMetadata\Hooks\SkinAfterBottomScriptsHandler
|
||||
|
@ -35,7 +35,7 @@ class SkinAfterBottomScriptsHandlerTest extends \MediaWikiIntegrationTestCase {
|
|||
$this->assertEquals( $expectedSchema, $actualSchema );
|
||||
}
|
||||
|
||||
public function provideImageWithLicenseData() {
|
||||
public static function provideImageWithLicenseData() {
|
||||
$metadata = [
|
||||
'LicenseUrl' => [
|
||||
'value' => 'https://creativecommons.org/licenses/by-sa/4.0',
|
||||
|
@ -70,7 +70,8 @@ class SkinAfterBottomScriptsHandlerTest extends \MediaWikiIntegrationTestCase {
|
|||
/**
|
||||
* @dataProvider provideInvalidFiles
|
||||
*/
|
||||
public function testGetSchemaElementWithInvalidFiles( $file ) {
|
||||
public function testGetSchemaElementWithInvalidFiles( $mockExists, $mockMediaType ) {
|
||||
$file = $mockExists === null ? null : $this->getMockFile( $mockExists, $mockMediaType );
|
||||
// We'll set up the mock format's fetchExtendedMetadata method to return
|
||||
// an empty array so we can test the scenario of a valid file that gets
|
||||
// back no extended metadata.
|
||||
|
@ -83,16 +84,12 @@ class SkinAfterBottomScriptsHandlerTest extends \MediaWikiIntegrationTestCase {
|
|||
$this->assertSame( '', $result );
|
||||
}
|
||||
|
||||
public function provideInvalidFiles() {
|
||||
$nonexistentFile = $this->getMockFile( false, null );
|
||||
$wrongMediaTypeFile = $this->getMockFile( true, MEDIATYPE_AUDIO );
|
||||
$validFile = $this->getMockFile( true, MEDIATYPE_BITMAP );
|
||||
|
||||
public static function provideInvalidFiles() {
|
||||
return [
|
||||
'Null value' => [ null ],
|
||||
'Nonexistent file' => [ $nonexistentFile ],
|
||||
'Wrong media type' => [ $wrongMediaTypeFile ] ,
|
||||
'No extended metadata' => [ $validFile ]
|
||||
'Null value' => [ null, null ],
|
||||
'Nonexistent file' => [ false, null ],
|
||||
'Wrong media type' => [ true, MEDIATYPE_AUDIO ] ,
|
||||
'No extended metadata' => [ true, MEDIATYPE_BITMAP ]
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -113,7 +110,7 @@ class SkinAfterBottomScriptsHandlerTest extends \MediaWikiIntegrationTestCase {
|
|||
$this->assertEquals( $expected, $actual );
|
||||
}
|
||||
|
||||
public function providePublicDomainImageData() {
|
||||
public static function providePublicDomainImageData() {
|
||||
$metadata = [
|
||||
'License' => [
|
||||
'value' => 'pd',
|
||||
|
@ -140,7 +137,7 @@ class SkinAfterBottomScriptsHandlerTest extends \MediaWikiIntegrationTestCase {
|
|||
];
|
||||
}
|
||||
|
||||
public function provideImageWithMissingUploadDateData() {
|
||||
public static function provideImageWithMissingUploadDateData() {
|
||||
$metadata = [
|
||||
'LicenseUrl' => [
|
||||
'value' => 'https://creativecommons.org/licenses/by-sa/4.0',
|
||||
|
|
|
@ -123,7 +123,7 @@ class LicenseParserTest extends \MediaWikiIntegrationTestCase {
|
|||
$this->assertLicenseHasGreaterPriority( $greaterLicenseData, $smallerLicenseData );
|
||||
}
|
||||
|
||||
public function provideGetLicensePriorityData() {
|
||||
public static function provideGetLicensePriorityData() {
|
||||
return [
|
||||
[ // PD wins over CC
|
||||
[ // this should have higher priority...
|
||||
|
|
|
@ -6,6 +6,7 @@ use ForeignAPIFile;
|
|||
use ForeignDBFile;
|
||||
use IContextSource;
|
||||
use LocalFile;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ParserTestHelper {
|
||||
|
@ -189,7 +190,7 @@ class ParserTestHelper {
|
|||
* @return IContextSource
|
||||
*/
|
||||
public function getContext( $languageCode ) {
|
||||
$language = \Language::factory( $languageCode );
|
||||
$language = MediaWikiServices::getInstance()->getLanguageFactory()->getLanguage( $languageCode );
|
||||
$context = $this->testCase->getMockBuilder( IContextSource::class )
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
|
正在加载...
在新工单中引用