From e90513c5cd212e5bb73736fab28a269a219cda8c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thiemo=20M=C3=A4ttig?= Date: Mon, 20 Apr 2015 15:41:28 +0200 Subject: [PATCH] Drop unused FormatMetadata::flattenArray method This is a pure helper method, not closely related to this class, and currently unused. Change-Id: I278058677ad407aae8cd2ba8fe34c12b1e86033f --- includes/media/FormatMetadata.php | 22 ------------- .../includes/media/FormatMetadataTest.php | 33 ------------------- 2 files changed, 55 deletions(-) diff --git a/includes/media/FormatMetadata.php b/includes/media/FormatMetadata.php index 7246072ded..0c6b6c7271 100644 --- a/includes/media/FormatMetadata.php +++ b/includes/media/FormatMetadata.php @@ -1003,28 +1003,6 @@ class FormatMetadata extends ContextSource { return $obj->flattenArrayReal( $vals, $type, $noHtml ); } - /** - * Flatten an array, using the user language for any messages. - * - * @param array $vals Array of values - * @param string $type Type of array (either lang, ul, ol). - * lang = language assoc array with keys being the lang code - * ul = unordered list, ol = ordered list - * type can also come from the '_type' member of $vals. - * @param bool $noHtml If to avoid returning anything resembling HTML. - * (Ugly hack for backwards compatibility with old MediaWiki). - * @param bool|IContextSource $context - * @return string Single value (in wiki-syntax). - */ - public static function flattenArray( $vals, $type = 'ul', $noHtml = false, $context = false ) { - $obj = new FormatMetadata; - if ( $context ) { - $obj->setContext( $context ); - } - - return $obj->flattenArrayReal( $vals, $type, $noHtml ); - } - /** * A function to collapse multivalued tags into a single value. * This turns an array of (for example) authors into a bulleted list. diff --git a/tests/phpunit/includes/media/FormatMetadataTest.php b/tests/phpunit/includes/media/FormatMetadataTest.php index 54758f9486..b666c83c01 100644 --- a/tests/phpunit/includes/media/FormatMetadataTest.php +++ b/tests/phpunit/includes/media/FormatMetadataTest.php @@ -36,39 +36,6 @@ class FormatMetadataTest extends MediaWikiMediaTestCase { 'File with invalid date metadata (bug 29471)' ); } - /** - * @param string $filename - * @param int $expected Total image area - * @dataProvider provideFlattenArray - * @covers FormatMetadata::flattenArray - */ - public function testFlattenArray( $vals, $type, $noHtml, $ctx, $expected ) { - $actual = FormatMetadata::flattenArray( $vals, $type, $noHtml, $ctx ); - $this->assertEquals( $expected, $actual ); - } - - public static function provideFlattenArray() { - return array( - array( - array( 1, 2, 3 ), 'ul', false, false, - "", - ), - array( - array( 1, 2, 3 ), 'ol', false, false, - "
  1. 1
  2. \n
  3. 2
  4. \n
  5. 3
", - ), - array( - array( 1, 2, 3 ), 'ul', true, false, - "\n*1\n*2\n*3", - ), - array( - array( 1, 2, 3 ), 'ol', true, false, - "\n#1\n#2\n#3", - ), - // TODO: more test cases - ); - } - /** * @param mixed $input * @param mixed $output -- 2.20.1