Merge "Remove Revision::getRevisionText from migrateArchiveText"
[lhc/web/wiklou.git] / tests / phpunit / includes / media / JpegPixelFormatTest.php
index 6815a62..8d0ddf8 100644 (file)
@@ -1,11 +1,12 @@
 <?php
+
+use MediaWiki\Shell\Shell;
+
 /**
  * Tests related to JPEG chroma subsampling via $wgJpegPixelFormat setting.
  *
  * @group Media
  * @group medium
- *
- * @todo covers tags
  */
 class JpegPixelFormatTest extends MediaWikiMediaTestCase {
 
@@ -23,6 +24,7 @@ class JpegPixelFormatTest extends MediaWikiMediaTestCase {
        /**
         *
         * @dataProvider providePixelFormats
+        * @covers BitmapHandler::imageMagickSubsampling
         */
        public function testPixelFormatRendering( $sourceFile, $pixelFormat, $samplingFactor ) {
                global $wgUseImageMagick, $wgUseImageResize;
@@ -47,21 +49,21 @@ class JpegPixelFormatTest extends MediaWikiMediaTestCase {
                $path = $thumb->getLocalCopyPath();
                $this->assertTrue( is_string( $path ), "path returned for JPEG thumbnail for $fmtStr" );
 
-               $cmd = [
-                       'identify',
+               $result = Shell::command( 'identify',
                        '-format',
                        '%[jpeg:sampling-factor]',
                        $path
-               ];
-               $retval = null;
-               $output = wfShellExec( $cmd, $retval );
-               $this->assertTrue( $retval === 0, "ImageMagick's identify command should return success" );
+               )->execute();
+               $this->assertSame( 0,
+                       $result->getExitCode(),
+                       "ImageMagick's identify command should return success"
+               );
 
                $expected = $samplingFactor;
-               $actual = trim( $output );
+               $actual = trim( $result->getStdout() );
                $this->assertEquals(
                        $expected,
-                       trim( $output ),
+                       $actual,
                        "IM identify expects JPEG chroma subsampling \"$expected\" for $fmtStr"
                );
        }