Ensure users are able to edit the page after changing the content model
[lhc/web/wiklou.git] / tests / phpunit / includes / media / XMPTest.php
index 6758e94..bffe415 100644 (file)
@@ -34,35 +34,35 @@ class XMPTest extends MediaWikiTestCase {
 
        public static function provideXMPParse() {
                $xmpPath = __DIR__ . '/../../data/xmp/';
-               $data = array();
+               $data = [];
 
                // $xmpFiles format: array of arrays with first arg file base name,
                // with the actual file having .xmp on the end for the xmp
                // and .result.php on the end for a php file containing the result
                // array. Second argument is some info on what's being tested.
-               $xmpFiles = array(
-                       array( '1', 'parseType=Resource test' ),
-                       array( '2', 'Structure with mixed attribute and element props' ),
-                       array( '3', 'Extra qualifiers (that should be ignored)' ),
-                       array( '3-invalid', 'Test ignoring qualifiers that look like normal props' ),
-                       array( '4', 'Flash as qualifier' ),
-                       array( '5', 'Flash as qualifier 2' ),
-                       array( '6', 'Multiple rdf:Description' ),
-                       array( '7', 'Generic test of several property types' ),
-                       array( 'flash', 'Test of Flash property' ),
-                       array( 'invalid-child-not-struct', 'Test child props not in struct or ignored' ),
-                       array( 'no-recognized-props', 'Test namespace and no recognized props' ),
-                       array( 'no-namespace', 'Test non-namespaced attributes are ignored' ),
-                       array( 'bag-for-seq', "Allow bag's instead of seq's. (bug 27105)" ),
-                       array( 'utf16BE', 'UTF-16BE encoding' ),
-                       array( 'utf16LE', 'UTF-16LE encoding' ),
-                       array( 'utf32BE', 'UTF-32BE encoding' ),
-                       array( 'utf32LE', 'UTF-32LE encoding' ),
-                       array( 'xmpExt', 'Extended XMP missing second part' ),
-                       array( 'gps', 'Handling of exif GPS parameters in XMP' ),
-               );
-
-               $xmpFiles[] = array( 'doctype-included', 'XMP includes doctype' );
+               $xmpFiles = [
+                       [ '1', 'parseType=Resource test' ],
+                       [ '2', 'Structure with mixed attribute and element props' ],
+                       [ '3', 'Extra qualifiers (that should be ignored)' ],
+                       [ '3-invalid', 'Test ignoring qualifiers that look like normal props' ],
+                       [ '4', 'Flash as qualifier' ],
+                       [ '5', 'Flash as qualifier 2' ],
+                       [ '6', 'Multiple rdf:Description' ],
+                       [ '7', 'Generic test of several property types' ],
+                       [ 'flash', 'Test of Flash property' ],
+                       [ 'invalid-child-not-struct', 'Test child props not in struct or ignored' ],
+                       [ 'no-recognized-props', 'Test namespace and no recognized props' ],
+                       [ 'no-namespace', 'Test non-namespaced attributes are ignored' ],
+                       [ 'bag-for-seq', "Allow bag's instead of seq's. (bug 27105)" ],
+                       [ 'utf16BE', 'UTF-16BE encoding' ],
+                       [ 'utf16LE', 'UTF-16LE encoding' ],
+                       [ 'utf32BE', 'UTF-32BE encoding' ],
+                       [ 'utf32LE', 'UTF-32LE encoding' ],
+                       [ 'xmpExt', 'Extended XMP missing second part' ],
+                       [ 'gps', 'Handling of exif GPS parameters in XMP' ],
+               ];
+
+               $xmpFiles[] = [ 'doctype-included', 'XMP includes doctype' ];
 
                foreach ( $xmpFiles as $file ) {
                        $xmp = file_get_contents( $xmpPath . $file[0] . '.xmp' );
@@ -71,7 +71,7 @@ class XMPTest extends MediaWikiTestCase {
                        // file.
                        $result = null;
                        include $xmpPath . $file[0] . '.result.php';
-                       $data[] = array( $xmp, $result, '[' . $file[0] . '.xmp] ' . $file[1] );
+                       $data[] = [ $xmp, $result, '[' . $file[0] . '.xmp] ' . $file[1] ];
                }
 
                return $data;
@@ -100,13 +100,13 @@ class XMPTest extends MediaWikiTestCase {
                $reader->parseExtended( $extendedPacket );
                $actual = $reader->getResults();
 
-               $expected = array(
-                       'xmp-exif' => array(
+               $expected = [
+                       'xmp-exif' => [
                                'DigitalZoomRatio' => '0/10',
                                'Flash' => 9,
                                'FNumber' => '2/10',
-                       )
-               );
+                       ]
+               ];
 
                $this->assertEquals( $expected, $actual );
        }
@@ -132,12 +132,12 @@ class XMPTest extends MediaWikiTestCase {
                $reader->parseExtended( $extendedPacket );
                $actual = $reader->getResults();
 
-               $expected = array(
-                       'xmp-exif' => array(
+               $expected = [
+                       'xmp-exif' => [
                                'DigitalZoomRatio' => '0/10',
                                'Flash' => 9,
-                       )
-               );
+                       ]
+               ];
 
                $this->assertEquals( $expected, $actual );
        }
@@ -163,19 +163,19 @@ class XMPTest extends MediaWikiTestCase {
                $reader->parseExtended( $extendedPacket );
                $actual = $reader->getResults();
 
-               $expected = array(
-                       'xmp-exif' => array(
+               $expected = [
+                       'xmp-exif' => [
                                'DigitalZoomRatio' => '0/10',
                                'Flash' => 9,
-                       )
-               );
+                       ]
+               ];
 
                $this->assertEquals( $expected, $actual );
        }
 
        /**
         * Test for multi-section, hostile XML
-        * @covers checkParseSafety
+        * @covers XMPReader::checkParseSafety
         */
        public function testCheckParseSafety() {
 
@@ -190,7 +190,7 @@ class XMPTest extends MediaWikiTestCase {
                } while ( !feof( $file ) );
                $this->assertFalse( $valid, 'Check that doctype is detected in fragmented XML' );
                $this->assertEquals(
-                       array(),
+                       [],
                        $reader->getResults(),
                        'Check that doctype is detected in fragmented XML'
                );
@@ -210,12 +210,12 @@ class XMPTest extends MediaWikiTestCase {
                        'Check for false-positive detecting doctype in fragmented XML'
                );
                $this->assertEquals(
-                       array(
-                               'xmp-exif' => array(
+                       [
+                               'xmp-exif' => [
                                        'DigitalZoomRatio' => '0/10',
                                        'Flash' => '9'
-                               )
-                       ),
+                               ]
+                       ],
                        $reader->getResults(),
                        'Check that doctype is detected in fragmented XML'
                );