Gergő Tisza has uploaded a new change for review.
https://gerrit.wikimedia.org/r/231505
Change subject: Rename extmetadata labels to be more intuitive
......................................................................
Rename extmetadata labels to be more intuitive
Bug: T71914
Change-Id: Icd8428ec090949323f22f9e4a8f665b720ee9e7c
---
M DataCollector.php
M TemplateParser.php
M tests/data/File_Dala_Kyrka.JPG.php
M tests/data/File_Pentacle_3.svg.php
M tests/data/File_Sunrise_over_fishing_boats_in_Kerala.jpg.php
M tests/html/File_Bust_of_Wilhelmine_of_Bayreuth.jpg.html
M tests/phpunit/DataCollectorTest.php
M tests/phpunit/LicenseParserTest.php
M tests/phpunit/TemplateParserTest.php
9 files changed, 103 insertions(+), 74 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CommonsMetadata
refs/changes/05/231505/1
diff --git a/DataCollector.php b/DataCollector.php
index 12cc375..19067fd 100644
--- a/DataCollector.php
+++ b/DataCollector.php
@@ -97,6 +97,7 @@
$previousMetadata = array_merge( $previousMetadata,
$this->getCategoryMetadata( $categories ) );
$templateData = $this->templateParser->parsePage(
$descriptionText );
+ $this->addFallbackKeys( $templateData ); // FIXME remove after
a few months T71914
$previousMetadata = array_merge( $previousMetadata,
$this->getTemplateMetadata( $templateData ) );
}
@@ -124,17 +125,17 @@
if ( !isset( $licenseData['LicenseShortName'] ) ||
$licenseData['LicenseShortName'] === '' ) {
$problems[] = 'no-license';
}
- if ( !isset( $informationData['ImageDescription'] ) ||
$informationData['ImageDescription'] === '' ) {
+ if ( !isset( $informationData['FileDescription'] ) ||
$informationData['FileDescription'] === '' ) {
$problems[] = 'no-description';
}
if (
- ( !isset( $informationData['Artist'] ) ||
$informationData['Artist'] === '' )
+ ( !isset( $informationData['Author'] ) ||
$informationData['Author'] === '' )
&& ( !isset( $informationData['Attribution'] ) ||
$informationData['Attribution'] === '' )
) {
$problems[] = 'no-author';
}
if (
- ( !isset( $informationData['Credit'] ) ||
$informationData['Credit'] === '' )
+ ( !isset( $informationData['Source'] ) ||
$informationData['Source'] === '' )
&& ( !isset( $informationData['Attribution'] ) ||
$informationData['Attribution'] === '' )
) {
$problems[] = 'no-source';
@@ -360,7 +361,7 @@
$authorCount = 0;
foreach ( $informationTemplates as $template ) {
- if ( isset( $template['Artist'] ) ) {
+ if ( isset( $template['Author'] ) ) {
$authorCount++;
}
}
@@ -408,4 +409,33 @@
}
}
}
+
+ /**
+ * B/C for T71914
+ */
+ protected function addFallbackKeys( &$data ) {
+ if ( !$data ) {
+ return;
+ }
+
+ $fallbacks = array(
+ 'Author' => 'Artist',
+ 'Source' => 'Credit',
+ 'FileDescription' => 'ImageDescription',
+ 'LicenseLongName' => 'UsageTerms',
+ );
+
+ foreach ( array( TemplateParser::INFORMATION_FIELDS_KEY,
TemplateParser::LICENSES_KEY ) as $group ) {
+ if ( !isset( $data[$group] ) ) {
+ continue;
+ }
+ foreach ( $data[$group] as $i => $_ ) {
+ foreach ( $fallbacks as $new => $old ) {
+ if ( isset( $data[$group][$i] ) &&
array_key_exists( $new, $data[$group][$i] ) ) {
+ $data[$group][$i][$old] =
$data[$group][$i][$new];
+ }
+ }
+ }
+ }
+ }
}
diff --git a/TemplateParser.php b/TemplateParser.php
index a8ca959..ac99353 100644
--- a/TemplateParser.php
+++ b/TemplateParser.php
@@ -24,7 +24,7 @@
*/
protected static $licenseFieldClasses = array(
'licensetpl_short' => 'LicenseShortName',
- 'licensetpl_long' => 'UsageTerms',
+ 'licensetpl_long' => 'LicenseLongName',
'licensetpl_attr_req' => 'AttributionRequired',
'licensetpl_attr' => 'Attribution',
// 'licensetpl_link_req',
@@ -37,13 +37,13 @@
* @var array
*/
protected static $informationFieldClasses = array(
- 'fileinfotpl_desc' => 'ImageDescription',
+ 'fileinfotpl_desc' => 'FileDescription',
# For date: Open question - should we parse the commons
# date field better to deal with templates like
# {{Taken on}} et al. along with extracting a time stamp
# from the human readable field?
'fileinfotpl_date' => 'DateTimeOriginal',
- 'fileinfotpl_aut' => 'Artist',
+ 'fileinfotpl_aut' => 'Author',
# For "source" field of {{information}} there are two closely
# related fields we could map it to. Credit (iptc 2:110) is
# "Identifies the provider of the media, not necessarily the
@@ -52,7 +52,7 @@
# could be an agency, a member of an agency or an individual."
# I think "Credit" fits much more closely to the commons notion
# of source than "Source" does.
- 'fileinfotpl_src' => 'Credit',
+ 'fileinfotpl_src' => 'Source',
'fileinfotpl_art_title' => 'ObjectName',
'fileinfotpl_perm' => 'Permission',
'fileinfotpl_credit' => 'Attribution',
@@ -163,7 +163,7 @@
/**
* Parses the {{Information}} templates (and anything using the same
metadata notation, like {{Artwork}})
* @param DomNavigator $domNavigator
- * @return array an array if information(-like) templates: array( 0 =>
array( 'ImageDescription' => ... ) ... )
+ * @return array an array if information(-like) templates: array( 0 =>
array( 'FileDescription' => ... ) ... )
*/
protected function parseInformationFields( DomNavigator $domNavigator )
{
$attributePrefix = 'fileinfotpl_';
@@ -275,7 +275,7 @@
* @param DOMNode $node
* @return string
*/
- protected function parseFieldArtist( DomNavigator $domNavigator,
DOMNode $node ) {
+ protected function parseFieldAuthor( DomNavigator $domNavigator,
DOMNode $node ) {
if ( $field = $this->extractHCardProperty( $domNavigator,
$node, 'fn' ) ) {
return $this->cleanedInnerHtml( $field );
}
@@ -321,8 +321,8 @@
$data = array();
foreach ( $domNavigator->findElementsWithClass( '*',
'licensetpl' ) as $licenseNode ) {
$licenseData = $this->parseLicenseNode( $domNavigator,
$licenseNode );
- if ( isset( $licenseData['UsageTerms'] ) ) {
- $licenseData['Copyrighted'] = (
$licenseData['UsageTerms'] === 'Public domain' ) ? 'False' : 'True';
+ if ( isset( $licenseData['LicenseLongName'] ) ) {
+ $licenseData['Copyrighted'] = (
$licenseData['LicenseLongName'] === 'Public domain' ) ? 'False' : 'True';
}
$data[] = $licenseData;
}
diff --git a/tests/data/File_Dala_Kyrka.JPG.php
b/tests/data/File_Dala_Kyrka.JPG.php
index 5dcd704..82ba61c 100644
--- a/tests/data/File_Dala_Kyrka.JPG.php
+++ b/tests/data/File_Dala_Kyrka.JPG.php
@@ -15,17 +15,17 @@
'value' => 'cc-by-sa-3.0',
'source' => 'commons-templates',
),
- 'ImageDescription' =>
+ 'FileDescription' =>
array (
'value' => 'Dala kyrka, mot väg',
'source' => 'commons-desc-page',
),
- 'Credit' =>
+ 'Source' =>
array (
'value' => '<span class="int-own-work">Own work</span>',
'source' => 'commons-desc-page',
),
- 'Artist' =>
+ 'Author' =>
array (
'value' => '<a
href="//commons.wikimedia.org/w/index.php?title=User:Fhille&action=edit&redlink=1"
class="new" title="User:Fhille (page does not exist)">Fhille</a>',
'source' => 'commons-desc-page',
@@ -35,7 +35,7 @@
'value' => 'CC-BY-SA-3.0',
'source' => 'commons-desc-page',
),
- 'UsageTerms' =>
+ 'LicenseLongName' =>
array (
'value' => 'Creative Commons Attribution-Share Alike
3.0',
'source' => 'commons-desc-page',
diff --git a/tests/data/File_Pentacle_3.svg.php
b/tests/data/File_Pentacle_3.svg.php
index eb3386f..2fbb707 100644
--- a/tests/data/File_Pentacle_3.svg.php
+++ b/tests/data/File_Pentacle_3.svg.php
@@ -8,7 +8,7 @@
'value' => 'CC-BY-SA-3.0',
'source' => 'commons-desc-page',
),
- 'UsageTerms' =>
+ 'LicenseLongName' =>
array (
'value' => 'Creative Commons Attribution-Share Alike
3.0',
'source' => 'commons-desc-page',
diff --git a/tests/data/File_Sunrise_over_fishing_boats_in_Kerala.jpg.php
b/tests/data/File_Sunrise_over_fishing_boats_in_Kerala.jpg.php
index 65d3232..5ea5e83 100644
--- a/tests/data/File_Sunrise_over_fishing_boats_in_Kerala.jpg.php
+++ b/tests/data/File_Sunrise_over_fishing_boats_in_Kerala.jpg.php
@@ -16,17 +16,17 @@
'value' => 'cc-by-sa-3.0',
'source' => 'commons-templates',
),
- 'ImageDescription' =>
+ 'FileDescription' =>
array (
'value' => 'Sunrise over fishing boats on the beach
south of <a href="//en.wikipedia.org/wiki/Kovalam" class="extiw"
title="en:Kovalam">Kovalam</a>, Kerala, South India.',
'source' => 'commons-desc-page',
),
- 'Credit' =>
+ 'Source' =>
array (
'value' => '<span class="int-own-work">Own work</span>',
'source' => 'commons-desc-page',
),
- 'Artist' =>
+ 'Author' =>
array (
'value' => '<a
href="//commons.wikimedia.org/wiki/User:Fabrice_Florin" title="User:Fabrice
Florin">User:Fabrice Florin</a>',
'source' => 'commons-desc-page',
@@ -36,7 +36,7 @@
'value' => 'CC-BY-SA-3.0',
'source' => 'commons-desc-page',
),
- 'UsageTerms' =>
+ 'LicenseLongName' =>
array (
'value' => 'Creative Commons Attribution-Share Alike
3.0',
'source' => 'commons-desc-page',
diff --git a/tests/html/File_Bust_of_Wilhelmine_of_Bayreuth.jpg.html
b/tests/html/File_Bust_of_Wilhelmine_of_Bayreuth.jpg.html
index 1543cb2..d5cc635 100644
--- a/tests/html/File_Bust_of_Wilhelmine_of_Bayreuth.jpg.html
+++ b/tests/html/File_Bust_of_Wilhelmine_of_Bayreuth.jpg.html
@@ -2,7 +2,7 @@
<div class="hproduct commons-file-information-table">
<table class="fileinfotpl-type-artwork toccolours vevent mw-content-ltr"
dir="ltr" style="width: 100%" cellpadding="4">
<tr valign="top">
-<td id="fileinfotpl_aut" class="type fileinfo-paramfield">Artist</td>
+<td id="fileinfotpl_aut" class="type fileinfo-paramfield">Author</td>
<td><span class="fn value">Gabriele Plössner</span></td>
</tr>
<tr valign="top">
@@ -30,7 +30,7 @@
<td id="fileinfotpl_art_location"><span class="locality">Gontard-Anlage
Bayreuth (<span class="plainlinks nourlexpansion"><a class="external text"
href="http://tools.wmflabs.org/geohack/geohack.php?pagename=File:Bust_of_Wilhelmine_of_Bayreuth.jpg&params=49.944208_N_11.577695_E_dim:100"><span
class="geo-nondefault"><span class="geo-dms" title="Maps, aerial photos, and
other data for this location"><span class="latitude">49°56′39″N</span> <span
class="longitude">11°34′40″E</span></span></span><span
class="geo-multi-punct"> / </span><span class="geo-default"><span
class="geo-dec" title="Maps, aerial photos, and other data for this
location">49.944208°N 11.577695°E</span><span style="display:none"> / <span
class="geo">49.944208; 11.577695</span></span></span></a></span>)</span></td>
</tr>
<tr valign="top">
-<td id="fileinfotpl_art_credit_line" class="fileinfo-paramfield">Credit
line</td>
+<td id="fileinfotpl_art_credit_line" class="fileinfo-paramfield">Source
line</td>
<td>Gestiftet von dem Verein Markgräfliches Bayreuth</td>
</tr>
<tr valign="top">
diff --git a/tests/phpunit/DataCollectorTest.php
b/tests/phpunit/DataCollectorTest.php
index d4c625d..c3eb320 100644
--- a/tests/phpunit/DataCollectorTest.php
+++ b/tests/phpunit/DataCollectorTest.php
@@ -88,7 +88,7 @@
$this->templateParser->expects( $this->once() )->method(
'parsePage' )
->will( $this->returnValue( array(
TemplateParser::LICENSES_KEY => array(
- array( 'UsageTerms' => 'foo' ),
+ array( 'LicenseLongName' => 'foo' ),
),
) ) );
$this->licenseParser->expects( $this->any() )->method(
'parseLicenseString' )
@@ -97,14 +97,14 @@
$this->dataCollector->collect( $metadata, $this->file );
- $this->assertMetadataValue( 'UsageTerms', 'foo', $metadata );
+ $this->assertMetadataValue( 'LicenseLongName', 'foo', $metadata
);
}
public function testTemplateMetadataFormatForMultiValuedProperty() {
$this->templateParser->expects( $this->once() )->method(
'parsePage' )
->will( $this->returnValue( array(
TemplateParser::LICENSES_KEY => array(
- array( 'UsageTerms' => 'foo' ),
+ array( 'LicenseLongName' => 'foo' ),
),
) ) );
$this->licenseParser->expects( $this->any() )->method(
'parseLicenseString' )
@@ -113,7 +113,7 @@
$this->dataCollector->collect( $metadata, $this->file );
- $this->assertMetadataValue( 'UsageTerms', 'foo', $metadata );
+ $this->assertMetadataValue( 'LicenseLongName', 'foo', $metadata
);
}
public function testMetadataTimestampNormalization() {
@@ -183,13 +183,13 @@
$getTemplateMetadataMethod = new \ReflectionMethod(
$this->dataCollector, 'getTemplateMetadata' );
$getTemplateMetadataMethod->setAccessible( true );
- $template1 = array( 'Artist' => 'a1', 'Foo' => 'x' );
- $template2 = array( 'Artist' => 'a2', 'Bar' => 'y' );
+ $template1 = array( 'Author' => 'a1', 'Foo' => 'x' );
+ $template2 = array( 'Author' => 'a2', 'Bar' => 'y' );
$templateData = $getTemplateMetadataMethod->invokeArgs(
$this->dataCollector, array( array(
TemplateParser::INFORMATION_FIELDS_KEY => array(
$template1, $template2 ),
) ) );
- $this->assertMetadataValue( 'Artist', 'a1', $templateData );
+ $this->assertMetadataValue( 'Author', 'a1', $templateData );
$this->assertMetadataValue( 'Foo', 'x', $templateData );
$this->assertArrayNotHasKey( 'Bar', $templateData );
$this->assertMetadataValue( 'AuthorCount', 2, $templateData );
@@ -201,9 +201,9 @@
$this->templateParser->expects( $this->once() )->method(
'parsePage' )
->will( $this->returnValue( array(
TemplateParser::INFORMATION_FIELDS_KEY =>
array( array(
- 'ImageDescription' => 'blah',
- 'Artist' => 'blah blah',
- 'Credit' => 'blah blah blah',
+ 'FileDescription' => 'blah',
+ 'Author' => 'blah blah',
+ 'Source' => 'blah blah blah',
) ),
TemplateParser::LICENSES_KEY => array( array(
'LicenseShortName' => 'quux' ) ),
) ) );
@@ -218,7 +218,7 @@
$this->templateParser->expects( $this->once() )->method(
'parsePage' )
->will( $this->returnValue( array(
TemplateParser::INFORMATION_FIELDS_KEY =>
array( array(
- 'ImageDescription' => 'blah',
+ 'FileDescription' => 'blah',
'Attribution' => 'blah blah',
) ),
TemplateParser::LICENSES_KEY => array( array(
'LicenseShortName' => 'quux' ) ),
diff --git a/tests/phpunit/LicenseParserTest.php
b/tests/phpunit/LicenseParserTest.php
index 0dc4f00..63b4439 100644
--- a/tests/phpunit/LicenseParserTest.php
+++ b/tests/phpunit/LicenseParserTest.php
@@ -207,15 +207,15 @@
// test with the same data structure that's used by the
collector
$licenseData = array(
array(
- 'UsageTerms' => 'foo',
+ 'LicenseLongName' => 'foo',
),
array(
'LicenseShortName' => 'cc-by-sa-2.0',
- 'UsageTerms' => 'Creative Commons',
+ 'LicenseLongName' => 'Creative Commons',
),
array(
'LicenseShortName' => 'cc-by-sa-4.0',
- 'UsageTerms' => 'Creative Commons',
+ 'LicenseLongName' => 'Creative Commons',
),
);
$expectedSortOrder = array( 2, 1, 0 );
diff --git a/tests/phpunit/TemplateParserTest.php
b/tests/phpunit/TemplateParserTest.php
index fcb57ad..b3217fe 100644
--- a/tests/phpunit/TemplateParserTest.php
+++ b/tests/phpunit/TemplateParserTest.php
@@ -26,11 +26,11 @@
*/
public function testDescriptionWithoutLanguage() {
$data = $this->parseTestHTML( 'simple' );
- $this->assertFieldContainsString( 'ImageDescription',
'Sunrise', $data, TemplateParser::INFORMATION_FIELDS_KEY );
+ $this->assertFieldContainsString( 'FileDescription', 'Sunrise',
$data, TemplateParser::INFORMATION_FIELDS_KEY );
$parser = $this->getParser( 'de' );
$data = $this->parseTestHTML( 'simple', $parser );
- $this->assertFieldContainsString( 'ImageDescription',
'Sunrise', $data, TemplateParser::INFORMATION_FIELDS_KEY );
+ $this->assertFieldContainsString( 'FileDescription', 'Sunrise',
$data, TemplateParser::INFORMATION_FIELDS_KEY );
}
/**
@@ -39,11 +39,11 @@
*/
public function testDescriptionInSingleLanguage() {
$data = $this->parseTestHTML( 'singlelang' );
- $this->assertFieldContainsString( 'ImageDescription', 'Dala
kyrka', $data, TemplateParser::INFORMATION_FIELDS_KEY );
+ $this->assertFieldContainsString( 'FileDescription', 'Dala
kyrka', $data, TemplateParser::INFORMATION_FIELDS_KEY );
$parser = $this->getParser( 'de' );
$data = $this->parseTestHTML( 'singlelang', $parser );
- $this->assertFieldContainsString( 'ImageDescription', 'Dala
kyrka', $data, TemplateParser::INFORMATION_FIELDS_KEY );
+ $this->assertFieldContainsString( 'FileDescription', 'Dala
kyrka', $data, TemplateParser::INFORMATION_FIELDS_KEY );
}
/**
@@ -53,11 +53,11 @@
*/
public function testDescriptionInSingleNonFallbackLanguage() {
$data = $this->parseTestHTML( 'no_english' );
- $this->assertFieldContainsString( 'ImageDescription',
'Balkana', $data, TemplateParser::INFORMATION_FIELDS_KEY );
+ $this->assertFieldContainsString( 'FileDescription', 'Balkana',
$data, TemplateParser::INFORMATION_FIELDS_KEY );
$parser = $this->getParser( 'de' );
$data = $this->parseTestHTML( 'no_english', $parser );
- $this->assertFieldContainsString( 'ImageDescription',
'Balkana', $data, TemplateParser::INFORMATION_FIELDS_KEY );
+ $this->assertFieldContainsString( 'FileDescription', 'Balkana',
$data, TemplateParser::INFORMATION_FIELDS_KEY );
}
/**
@@ -65,8 +65,8 @@
*/
public function testDescriptionOutsideLanguageTemplate() {
$data = $this->parseTestHTML( 'outside_lang' );
- $this->assertFieldContainsString( 'ImageDescription',
'Williamsburg Historic District', $data, TemplateParser::INFORMATION_FIELDS_KEY
);
- $this->assertFieldNotContainsString( 'ImageDescription', 'This
is an image of a place or building', $data,
TemplateParser::INFORMATION_FIELDS_KEY );
+ $this->assertFieldContainsString( 'FileDescription',
'Williamsburg Historic District', $data, TemplateParser::INFORMATION_FIELDS_KEY
);
+ $this->assertFieldNotContainsString( 'FileDescription', 'This
is an image of a place or building', $data,
TemplateParser::INFORMATION_FIELDS_KEY );
}
/**
@@ -75,27 +75,27 @@
*/
public function testDescriptionInMultipleLanguages() {
$data = $this->parseTestHTML( 'multilang' ); // en/fr/de
description
- $this->assertFieldContainsString( 'ImageDescription',
'Assembly', $data, TemplateParser::INFORMATION_FIELDS_KEY );
- $this->assertFieldNotContainsString( 'ImageDescription',
'Rassemblement', $data, TemplateParser::INFORMATION_FIELDS_KEY );
- $this->assertFieldNotContainsString( 'ImageDescription',
'Versammlung', $data, TemplateParser::INFORMATION_FIELDS_KEY );
+ $this->assertFieldContainsString( 'FileDescription',
'Assembly', $data, TemplateParser::INFORMATION_FIELDS_KEY );
+ $this->assertFieldNotContainsString( 'FileDescription',
'Rassemblement', $data, TemplateParser::INFORMATION_FIELDS_KEY );
+ $this->assertFieldNotContainsString( 'FileDescription',
'Versammlung', $data, TemplateParser::INFORMATION_FIELDS_KEY );
$parser = $this->getParser( 'fr' );
$data = $this->parseTestHTML( 'multilang', $parser );
- $this->assertFieldNotContainsString( 'ImageDescription',
'Assembly', $data, TemplateParser::INFORMATION_FIELDS_KEY );
- $this->assertFieldContainsString( 'ImageDescription',
'Rassemblement', $data, TemplateParser::INFORMATION_FIELDS_KEY );
- $this->assertFieldNotContainsString( 'ImageDescription',
'Versammlung', $data, TemplateParser::INFORMATION_FIELDS_KEY );
+ $this->assertFieldNotContainsString( 'FileDescription',
'Assembly', $data, TemplateParser::INFORMATION_FIELDS_KEY );
+ $this->assertFieldContainsString( 'FileDescription',
'Rassemblement', $data, TemplateParser::INFORMATION_FIELDS_KEY );
+ $this->assertFieldNotContainsString( 'FileDescription',
'Versammlung', $data, TemplateParser::INFORMATION_FIELDS_KEY );
$parser = $this->getParser( 'de' );
$data = $this->parseTestHTML( 'multilang', $parser );
- $this->assertFieldNotContainsString( 'ImageDescription',
'Assembly', $data, TemplateParser::INFORMATION_FIELDS_KEY );
- $this->assertFieldNotContainsString( 'ImageDescription',
'Rassemblement', $data, TemplateParser::INFORMATION_FIELDS_KEY );
- $this->assertFieldContainsString( 'ImageDescription',
'Versammlung', $data, TemplateParser::INFORMATION_FIELDS_KEY );
+ $this->assertFieldNotContainsString( 'FileDescription',
'Assembly', $data, TemplateParser::INFORMATION_FIELDS_KEY );
+ $this->assertFieldNotContainsString( 'FileDescription',
'Rassemblement', $data, TemplateParser::INFORMATION_FIELDS_KEY );
+ $this->assertFieldContainsString( 'FileDescription',
'Versammlung', $data, TemplateParser::INFORMATION_FIELDS_KEY );
$parser = $this->getParser( 'nl' );
$data = $this->parseTestHTML( 'multilang', $parser );
- $this->assertFieldContainsString( 'ImageDescription',
'Assembly', $data, TemplateParser::INFORMATION_FIELDS_KEY );
- $this->assertFieldNotContainsString( 'ImageDescription',
'Rassemblement', $data, TemplateParser::INFORMATION_FIELDS_KEY );
- $this->assertFieldNotContainsString( 'ImageDescription',
'Versammlung', $data, TemplateParser::INFORMATION_FIELDS_KEY );
+ $this->assertFieldContainsString( 'FileDescription',
'Assembly', $data, TemplateParser::INFORMATION_FIELDS_KEY );
+ $this->assertFieldNotContainsString( 'FileDescription',
'Rassemblement', $data, TemplateParser::INFORMATION_FIELDS_KEY );
+ $this->assertFieldNotContainsString( 'FileDescription',
'Versammlung', $data, TemplateParser::INFORMATION_FIELDS_KEY );
}
/**
@@ -106,8 +106,8 @@
$data = $this->parseTestHTML( 'multilang', $parser );
$data = $this->getAndAssertTemplateData( $data,
TemplateParser::INFORMATION_FIELDS_KEY );
- $this->assertArrayHasKey( 'ImageDescription', $data );
- $description = $data['ImageDescription'];
+ $this->assertArrayHasKey( 'FileDescription', $data );
+ $description = $data['FileDescription'];
$this->assertLanguageArray( $description );
unset( $description['_type'] );
@@ -123,8 +123,8 @@
$data = $this->parseTestHTML( 'singlelang', $parser );
$data = $this->getAndAssertTemplateData( $data,
TemplateParser::INFORMATION_FIELDS_KEY );
- $this->assertArrayHasKey( 'ImageDescription', $data );
- $description = $data['ImageDescription'];
+ $this->assertArrayHasKey( 'FileDescription', $data );
+ $description = $data['FileDescription'];
$this->assertLanguageArray( $description );
unset( $description['_type'] );
@@ -144,8 +144,8 @@
$data = $this->parseTestHTML( 'simple', $parser );
$data = $this->getAndAssertTemplateData( $data,
TemplateParser::INFORMATION_FIELDS_KEY );
- $this->assertArrayHasKey( 'ImageDescription', $data );
- $description = $data['ImageDescription'];
+ $this->assertArrayHasKey( 'FileDescription', $data );
+ $description = $data['FileDescription'];
$this->assertLanguageArray( $description );
unset( $description['_type'] );
@@ -158,7 +158,7 @@
*/
public function testLanguageNameNotPresent() {
$data = $this->parseTestHTML( 'singlelang' );
- $this->assertFieldNotContainsString( 'ImageDescription',
'English', $data, TemplateParser::INFORMATION_FIELDS_KEY );
+ $this->assertFieldNotContainsString( 'FileDescription',
'English', $data, TemplateParser::INFORMATION_FIELDS_KEY );
}
/**
@@ -166,7 +166,7 @@
*/
public function testSimpleWrappersAreRemoved() {
$data = $this->parseTestHTML( 'simple' );
- $this->assertFieldStartsWith( 'ImageDescription', 'Sunrise',
$data, TemplateParser::INFORMATION_FIELDS_KEY );
+ $this->assertFieldStartsWith( 'FileDescription', 'Sunrise',
$data, TemplateParser::INFORMATION_FIELDS_KEY );
}
/**
@@ -175,7 +175,7 @@
*/
public function testHCard() {
$data = $this->parseTestHTML( 'creator_template' );
- $this->assertFieldEquals( 'Artist',
+ $this->assertFieldEquals( 'Author',
'<bdi>After <a
href="//en.wikipedia.org/wiki/George_Gower" class="extiw" title="en:George
Gower">George Gower</a></bdi>',
$data, TemplateParser::INFORMATION_FIELDS_KEY );
}
@@ -196,7 +196,7 @@
*/
public function testClassBasedInfotemplate() {
$data = $this->parseTestHTML( 'infotpl_class' );
- $this->assertFieldEquals( 'ImageDescription',
+ $this->assertFieldEquals( 'FileDescription',
'Tom Baker as the <a
href="//en.wikipedia.org/wiki/Fourth_Doctor" title="Fourth Doctor">Fourth
Doctor</a> in Doctor Who.',
$data, TemplateParser::INFORMATION_FIELDS_KEY );
}
@@ -206,7 +206,7 @@
*/
public function testMultipleInfoTemplates() {
$data = $this->parseTestHTML( 'multiple_infotpl' );
- $this->assertFieldEquals( 'Artist',
+ $this->assertFieldEquals( 'Author',
'<span class="fn value"><a
href="//commons.wikimedia.org/wiki/User:El_Grafo" title="User:El Grafo">El
Grafo</a></span>',
$data, TemplateParser::INFORMATION_FIELDS_KEY );
}
@@ -233,8 +233,7 @@
$data = $this->parseTestHTML( 'simple' );
$this->assertFieldEquals( 'LicenseShortName', 'CC-BY-SA-3.0',
$data, TemplateParser::LICENSES_KEY );
- // long name is called UsageTerms - bug 57847
- $this->assertFieldEquals( 'UsageTerms', 'Creative Commons
Attribution-Share Alike 3.0', $data, TemplateParser::LICENSES_KEY );
+ $this->assertFieldEquals( 'LicenseLongName', 'Creative Commons
Attribution-Share Alike 3.0', $data, TemplateParser::LICENSES_KEY );
$this->assertFieldEquals( 'LicenseUrl',
'http://creativecommons.org/licenses/by-sa/3.0', $data,
TemplateParser::LICENSES_KEY );
$this->assertFieldEquals( 'Copyrighted', 'True', $data,
TemplateParser::LICENSES_KEY );
}
@@ -246,9 +245,9 @@
$this->assertFieldEquals( 'LicenseShortName', 'CC-BY-SA-3.0',
$data, TemplateParser::LICENSES_KEY, 1 );
$this->assertFieldEquals( 'LicenseShortName', 'CC-BY-SA-2.5',
$data, TemplateParser::LICENSES_KEY, 2 );
- $this->assertFieldEquals( 'UsageTerms', 'GNU Free Documentation
License', $data, TemplateParser::LICENSES_KEY, 0 );
- $this->assertFieldEquals( 'UsageTerms', 'Creative Commons
Attribution-Share Alike 3.0', $data, TemplateParser::LICENSES_KEY, 1 );
- $this->assertFieldEquals( 'UsageTerms', 'Creative Commons
Attribution-Share Alike 2.5', $data, TemplateParser::LICENSES_KEY, 2 );
+ $this->assertFieldEquals( 'LicenseLongName', 'GNU Free
Documentation License', $data, TemplateParser::LICENSES_KEY, 0 );
+ $this->assertFieldEquals( 'LicenseLongName', 'Creative Commons
Attribution-Share Alike 3.0', $data, TemplateParser::LICENSES_KEY, 1 );
+ $this->assertFieldEquals( 'LicenseLongName', 'Creative Commons
Attribution-Share Alike 2.5', $data, TemplateParser::LICENSES_KEY, 2 );
$this->assertFieldEquals( 'LicenseUrl',
'http://www.gnu.org/copyleft/fdl.html', $data, TemplateParser::LICENSES_KEY, 0
);
$this->assertFieldEquals( 'LicenseUrl',
'http://creativecommons.org/licenses/by-sa/3.0/', $data,
TemplateParser::LICENSES_KEY, 1 );
@@ -274,7 +273,7 @@
$parser = $this->getParser( 'ja' );
$data = $this->parseTestHTML( 'japanese', $parser );
- $this->assertFieldContainsString( 'ImageDescription',
'スーパーファミコン', $data, TemplateParser::INFORMATION_FIELDS_KEY );
+ $this->assertFieldContainsString( 'FileDescription',
'スーパーファミコン', $data, TemplateParser::INFORMATION_FIELDS_KEY );
}
/**
--
To view, visit https://gerrit.wikimedia.org/r/231505
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icd8428ec090949323f22f9e4a8f665b720ee9e7c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CommonsMetadata
Gerrit-Branch: master
Gerrit-Owner: Gergő Tisza <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits