Merge "Selenium: replace UserLoginPage with BlankPage where possible"
[lhc/web/wiklou.git] / tests / parser / ParserTestPrinter.php
index 94d226c..34f8cd5 100644 (file)
@@ -19,6 +19,8 @@
  * @ingroup Testing
  */
 
+use MediaWiki\Shell\Shell;
+
 /**
  * This is a TestRecorder responsible for printing information about progress,
  * success and failure to the console. It is specific to the parserTests.php
@@ -166,19 +168,12 @@ class ParserTestPrinter extends TestRecorder {
                        $output = strtr( $output, $pairs );
                }
 
-               # Windows, or at least the fc utility, is retarded
-               $slash = wfIsWindows() ? '\\' : '/';
-               $prefix = wfTempDir() . "{$slash}mwParser-" . mt_rand();
-
-               $infile = "$prefix-$inFileTail";
+               $infile = tempnam( wfTempDir(), "mwParser-$inFileTail" );
                $this->dumpToFile( $input, $infile );
 
-               $outfile = "$prefix-$outFileTail";
+               $outfile = tempnam( wfTempDir(), "mwParser-$outFileTail" );
                $this->dumpToFile( $output, $outfile );
 
-               $shellInfile = wfEscapeShellArg( $infile );
-               $shellOutfile = wfEscapeShellArg( $outfile );
-
                global $wgDiff3;
                // we assume that people with diff3 also have usual diff
                if ( $this->useDwdiff ) {
@@ -187,7 +182,11 @@ class ParserTestPrinter extends TestRecorder {
                        $shellCommand = ( wfIsWindows() && !$wgDiff3 ) ? 'fc' : 'diff -au';
                }
 
-               $diff = wfShellExec( "$shellCommand $shellInfile $shellOutfile" );
+               $result = Shell::command()
+                       ->unsafeParams( $shellCommand )
+                       ->params( $infile, $outfile )
+                       ->execute();
+               $diff = $result->getStdout();
 
                unlink( $infile );
                unlink( $outfile );