summaryrefslogtreecommitdiff
path: root/tests/phpunit/includes/media/FormatMetadataTest.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2015-06-04 07:31:04 +0200
committerPierre Schmitz <pierre@archlinux.de>2015-06-04 07:58:39 +0200
commitf6d65e533c62f6deb21342d4901ece24497b433e (patch)
treef28adf0362d14bcd448f7b65a7aaf38650f923aa /tests/phpunit/includes/media/FormatMetadataTest.php
parentc27b2e832fe25651ef2410fae85b41072aae7519 (diff)
Update to MediaWiki 1.25.1
Diffstat (limited to 'tests/phpunit/includes/media/FormatMetadataTest.php')
-rw-r--r--tests/phpunit/includes/media/FormatMetadataTest.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/phpunit/includes/media/FormatMetadataTest.php b/tests/phpunit/includes/media/FormatMetadataTest.php
index 002e2cb9..54758f94 100644
--- a/tests/phpunit/includes/media/FormatMetadataTest.php
+++ b/tests/phpunit/includes/media/FormatMetadataTest.php
@@ -68,4 +68,36 @@ class FormatMetadataTest extends MediaWikiMediaTestCase {
// TODO: more test cases
);
}
+
+ /**
+ * @param mixed $input
+ * @param mixed $output
+ * @dataProvider provideResolveMultivalueValue
+ * @covers FormatMetadata::resolveMultivalueValue
+ */
+ public function testResolveMultivalueValue( $input, $output ) {
+ $formatMetadata = new FormatMetadata();
+ $class = new ReflectionClass( 'FormatMetadata' );
+ $method = $class->getMethod( 'resolveMultivalueValue' );
+ $method->setAccessible( true );
+ $actualInput = $method->invoke( $formatMetadata, $input );
+ $this->assertEquals( $output, $actualInput );
+ }
+
+ public function provideResolveMultivalueValue() {
+ return array(
+ 'nonArray' => array( 'foo', 'foo' ),
+ 'multiValue' => array( array( 'first', 'second', 'third', '_type' => 'ol' ), 'first' ),
+ 'noType' => array( array( 'first', 'second', 'third' ), 'first' ),
+ 'typeFirst' => array( array( '_type' => 'ol', 'first', 'second', 'third' ), 'first' ),
+ 'multilang' => array(
+ array( 'en' => 'first', 'de' => 'Erste', '_type' => 'lang' ),
+ array( 'en' => 'first', 'de' => 'Erste', '_type' => 'lang' ),
+ ),
+ 'multilang-multivalue' => array(
+ array( 'en' => array( 'first', 'second' ), 'de' => array( 'Erste', 'Zweite' ), '_type' => 'lang' ),
+ array( 'en' => 'first', 'de' => 'Erste', '_type' => 'lang' ),
+ ),
+ );
+ }
}