Merge "Get timestamp from WikiPage, instead of Article"
[lhc/web/wiklou.git] / tests / phpunit / includes / media / WebPTest.php
index d36710a..b50fe80 100644 (file)
@@ -19,12 +19,13 @@ class WebPHandlerTest extends MediaWikiTestCase {
                $this->assertEquals( $expectedResult, WebPHandler::extractMetadata( $this->tempFileName ) );
        }
        public function provideTestExtractMetaData() {
+               // @codingStandardsIgnoreStart Generic.Files.LineLength
                return array(
                        // Files from https://developers.google.com/speed/webp/gallery2
                        array( "\x52\x49\x46\x46\x90\x68\x01\x00\x57\x45\x42\x50\x56\x50\x38\x4C\x83\x68\x01\x00\x2F\x8F\x01\x4B\x10\x8D\x38\x6C\xDB\x46\x92\xE0\xE0\x82\x7B\x6C",
                                array( 'compression' => 'lossless', 'width' => 400, 'height' => 301 ) ),
                        array( "\x52\x49\x46\x46\x64\x5B\x00\x00\x57\x45\x42\x50\x56\x50\x38\x58\x0A\x00\x00\x00\x10\x00\x00\x00\x8F\x01\x00\x2C\x01\x00\x41\x4C\x50\x48\xE5\x0E",
-                               array( 'compression' => 'unknown', 'animated' => false, 'transparency' => true, 'width' => 400, 'height' => 301) ),
+                               array( 'compression' => 'unknown', 'animated' => false, 'transparency' => true, 'width' => 400, 'height' => 301 ) ),
                        array( "\x52\x49\x46\x46\xA8\x72\x00\x00\x57\x45\x42\x50\x56\x50\x38\x4C\x9B\x72\x00\x00\x2F\x81\x81\x62\x10\x8D\x40\x8C\x24\x39\x6E\x73\x73\x38\x01\x96",
                                array( 'compression' => 'lossless', 'width' => 386, 'height' => 395 ) ),
                        array( "\x52\x49\x46\x46\xE0\x42\x00\x00\x57\x45\x42\x50\x56\x50\x38\x58\x0A\x00\x00\x00\x10\x00\x00\x00\x81\x01\x00\x8A\x01\x00\x41\x4C\x50\x48\x56\x10",
@@ -50,9 +51,9 @@ class WebPHandlerTest extends MediaWikiTestCase {
                        array( "\x52\x49\x46\x46\x7A\x19\x03\x00\x57\x45\x42\x50\x56\x50\x38\x20\x6E\x19\x03\x00\xB2\xF8\x09\x9D\x01\x2A\x00\x05\xD0\x02\x3E\xAD\x46\x99\x4A\xA5",
                                array( 'compression' => 'lossy', 'width' => 1280, 'height' => 720 ) ),
                        array( "\x52\x49\x46\x46\x44\xB3\x02\x00\x57\x45\x42\x50\x56\x50\x38\x20\x38\xB3\x02\x00\x52\x57\x06\x9D\x01\x2A\x00\x04\x04\x03\x3E\xA5\x44\x96\x49\x26",
-                               array( 'compression' => 'lossy', 'width' => 1024, 'height' => 772) ),
+                               array( 'compression' => 'lossy', 'width' => 1024, 'height' => 772 ) ),
                        array( "\x52\x49\x46\x46\x02\x43\x01\x00\x57\x45\x42\x50\x56\x50\x38\x20\xF6\x42\x01\x00\x12\xC0\x05\x9D\x01\x2A\x00\x04\xF0\x02\x3E\x79\x34\x93\x47\xA4",
-                               array( 'compression' => 'lossy', 'width' => 1024, 'height' => 752) ),
+                               array( 'compression' => 'lossy', 'width' => 1024, 'height' => 752 ) ),
 
                        // Animated file from https://groups.google.com/a/chromium.org/d/topic/blink-dev/Y8tRC4mdQz8/discussion
                        array( "\x52\x49\x46\x46\xD0\x0B\x02\x00\x57\x45\x42\x50\x56\x50\x38\x58\x0A\x00\x00\x00\x12\x00\x00\x00\x3F\x01\x00\x3F\x01\x00\x41\x4E",
@@ -66,6 +67,7 @@ class WebPHandlerTest extends MediaWikiTestCase {
                        array( 'RIFF1234WEBPVP8                     ', false ),
                        array( 'RIFF1234WEBPVP8L                    ', false ),
                );
+               // @codingStandardsIgnoreEnd
        }
 
        /**
@@ -75,12 +77,24 @@ class WebPHandlerTest extends MediaWikiTestCase {
                $this->assertEquals( $expectedResult, WebPHandler::extractMetadata( $filename ) );
        }
        public function provideTestWithFileExtractMetaData() {
-               return array(
-                               array( __DIR__ . '/../../data/media/2_webp_ll.webp',
-                                       array( 'compression' => 'lossless', 'width' => 386, 'height' => 395 ) ),
-                               array( __DIR__ . '/../../data/media/2_webp_a.webp',
-                                       array( 'compression' => 'lossy', 'animated' => false, 'transparency' => true, 'width' => 386, 'height' => 395 ) ),
-               );
+               return [
+                       [ __DIR__ . '/../../data/media/2_webp_ll.webp',
+                               [
+                                       'compression' => 'lossless',
+                                       'width' => 386,
+                                       'height' => 395
+                               ]
+                       ],
+                       [ __DIR__ . '/../../data/media/2_webp_a.webp',
+                               [
+                                       'compression' => 'lossy',
+                                       'animated' => false,
+                                       'transparency' => true,
+                                       'width' => 386,
+                                       'height' => 395
+                               ]
+                       ],
+               ];
        }
 
        /**
@@ -91,15 +105,15 @@ class WebPHandlerTest extends MediaWikiTestCase {
                $this->assertEquals( $expectedResult, $handler->getImageSize( null, $path ) );
        }
        public function provideTestGetImageSize() {
-               return array(
+               return [
                        // Public domain files from https://developers.google.com/speed/webp/gallery2
-                       array( __DIR__ . '/../../data/media/2_webp_a.webp', array( 386, 395 ) ),
-                       array( __DIR__ . '/../../data/media/2_webp_ll.webp', array( 386, 395 ) ),
-                       array( __DIR__ . '/../../data/media/webp_animated.webp', array( 300, 225 ) ),
+                       [ __DIR__ . '/../../data/media/2_webp_a.webp', [ 386, 395 ] ],
+                       [ __DIR__ . '/../../data/media/2_webp_ll.webp', [ 386, 395 ] ],
+                       [ __DIR__ . '/../../data/media/webp_animated.webp', [ 300, 225 ] ],
 
                        // Error cases
-                       array( __FILE__, false ),
-               );
+                       [ __FILE__, false ],
+               ];
        }
 
        /**
@@ -113,12 +127,12 @@ class WebPHandlerTest extends MediaWikiTestCase {
                $this->assertEquals( 'image/webp', $mime->guessMimeType( $path, false ) );
        }
        public function provideTestGetMimeType() {
-               return array(
+               return [
                                // Public domain files from https://developers.google.com/speed/webp/gallery2
-                               array( __DIR__ . '/../../data/media/2_webp_a.webp' ),
-                               array( __DIR__ . '/../../data/media/2_webp_ll.webp' ),
-                               array( __DIR__ . '/../../data/media/webp_animated.webp' ),
-               );
+                               [ __DIR__ . '/../../data/media/2_webp_a.webp' ],
+                               [ __DIR__ . '/../../data/media/2_webp_ll.webp' ],
+                               [ __DIR__ . '/../../data/media/webp_animated.webp' ],
+               ];
        }
 }