<?php
+
+/**
+ * @group Media
+ */
class BitmapMetadataHandlerTest extends MediaWikiTestCase {
protected function setUp() {
$meta = BitmapMetadataHandler::Jpeg( $this->filePath .
'/Xmp-exif-multilingual_test.jpg' );
- $expected = array(
+ $expected = [
'x-default' => 'right(iptc)',
'en' => 'right translation',
'_type' => 'lang'
- );
+ ];
$this->assertArrayHasKey( 'ImageDescription', $meta,
'Did not extract any ImageDescription info?!' );
*/
public function testMerging() {
$merger = new BitmapMetadataHandler();
- $merger->addMetadata( array( 'foo' => 'xmp' ), 'xmp-general' );
- $merger->addMetadata( array( 'bar' => 'xmp' ), 'xmp-general' );
- $merger->addMetadata( array( 'baz' => 'xmp' ), 'xmp-general' );
- $merger->addMetadata( array( 'fred' => 'xmp' ), 'xmp-general' );
- $merger->addMetadata( array( 'foo' => 'iptc (hash)' ), 'iptc-good-hash' );
- $merger->addMetadata( array( 'bar' => 'iptc (bad hash)' ), 'iptc-bad-hash' );
- $merger->addMetadata( array( 'baz' => 'iptc (bad hash)' ), 'iptc-bad-hash' );
- $merger->addMetadata( array( 'fred' => 'iptc (no hash)' ), 'iptc-no-hash' );
- $merger->addMetadata( array( 'baz' => 'exif' ), 'exif' );
+ $merger->addMetadata( [ 'foo' => 'xmp' ], 'xmp-general' );
+ $merger->addMetadata( [ 'bar' => 'xmp' ], 'xmp-general' );
+ $merger->addMetadata( [ 'baz' => 'xmp' ], 'xmp-general' );
+ $merger->addMetadata( [ 'fred' => 'xmp' ], 'xmp-general' );
+ $merger->addMetadata( [ 'foo' => 'iptc (hash)' ], 'iptc-good-hash' );
+ $merger->addMetadata( [ 'bar' => 'iptc (bad hash)' ], 'iptc-bad-hash' );
+ $merger->addMetadata( [ 'baz' => 'iptc (bad hash)' ], 'iptc-bad-hash' );
+ $merger->addMetadata( [ 'fred' => 'iptc (no hash)' ], 'iptc-no-hash' );
+ $merger->addMetadata( [ 'baz' => 'exif' ], 'exif' );
$actual = $merger->getMetadataArray();
- $expected = array(
+ $expected = [
'foo' => 'xmp',
'bar' => 'iptc (bad hash)',
'baz' => 'exif',
'fred' => 'xmp',
- );
+ ];
$this->assertEquals( $expected, $actual );
}
$this->markTestSkipped( "This test needs the xml extension." );
}
$handler = new BitmapMetadataHandler();
- $result = $handler->png( $this->filePath . 'xmp.png' );
- $expected = array(
+ $result = $handler->PNG( $this->filePath . 'xmp.png' );
+ $expected = [
'frameCount' => 0,
'loopCount' => 1,
'duration' => 0,
'bitDepth' => 1,
'colorType' => 'index-coloured',
- 'metadata' => array(
+ 'metadata' => [
'SerialNumber' => '123456789',
'_MW_PNG_VERSION' => 1,
- ),
- );
+ ],
+ ];
$this->assertEquals( $expected, $result );
}
*/
public function testPNGNative() {
$handler = new BitmapMetadataHandler();
- $result = $handler->png( $this->filePath . 'Png-native-test.png' );
+ $result = $handler->PNG( $this->filePath . 'Png-native-test.png' );
$expected = 'http://example.com/url';
$this->assertEquals( $expected, $result['metadata']['Identifier']['x-default'] );
}