From 1199f36b61dadc06410abe1484e41eea0e8c46a9 Mon Sep 17 00:00:00 2001 From: Max Semenik Date: Sat, 9 Feb 2019 22:20:25 -0800 Subject: [PATCH] JpegPixelFormatTest: use Shell class Change-Id: I53099827dc2b2b26b7f3cbc9f0e12030868fdafd --- .../includes/media/JpegPixelFormatTest.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/tests/phpunit/includes/media/JpegPixelFormatTest.php b/tests/phpunit/includes/media/JpegPixelFormatTest.php index c0a3e90082..630df54335 100644 --- a/tests/phpunit/includes/media/JpegPixelFormatTest.php +++ b/tests/phpunit/includes/media/JpegPixelFormatTest.php @@ -1,4 +1,7 @@ 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->assertEquals( 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" ); } -- 2.20.1