MediaWiki  REL1_24
GlobalTest.php
Go to the documentation of this file.
00001 <?php
00002 
00006 class GlobalTest extends MediaWikiTestCase {
00007     protected function setUp() {
00008         parent::setUp();
00009 
00010         $readOnlyFile = tempnam( wfTempDir(), "mwtest_readonly" );
00011         unlink( $readOnlyFile );
00012 
00013         $this->setMwGlobals( array(
00014             'wgReadOnlyFile' => $readOnlyFile,
00015             'wgUrlProtocols' => array(
00016                 'http://',
00017                 'https://',
00018                 'mailto:',
00019                 '//',
00020                 'file://', # Non-default
00021             ),
00022         ) );
00023     }
00024 
00025     protected function tearDown() {
00026         global $wgReadOnlyFile;
00027 
00028         if ( file_exists( $wgReadOnlyFile ) ) {
00029             unlink( $wgReadOnlyFile );
00030         }
00031 
00032         parent::tearDown();
00033     }
00034 
00039     public function testWfArrayDiff2( $a, $b, $expected ) {
00040         $this->assertEquals(
00041             wfArrayDiff2( $a, $b ), $expected
00042         );
00043     }
00044 
00045     // @todo Provide more tests
00046     public static function provideForWfArrayDiff2() {
00047         // $a $b $expected
00048         return array(
00049             array(
00050                 array( 'a', 'b' ),
00051                 array( 'a', 'b' ),
00052                 array(),
00053             ),
00054             array(
00055                 array( array( 'a' ), array( 'a', 'b', 'c' ) ),
00056                 array( array( 'a' ), array( 'a', 'b' ) ),
00057                 array( 1 => array( 'a', 'b', 'c' ) ),
00058             ),
00059         );
00060     }
00061 
00062     /*
00063      * Test cases for random functions could hypothetically fail,
00064      * even though they shouldn't.
00065      */
00066 
00070     public function testRandom() {
00071         $this->assertFalse(
00072             wfRandom() == wfRandom()
00073         );
00074     }
00075 
00079     public function testRandomString() {
00080         $this->assertFalse(
00081             wfRandomString() == wfRandomString()
00082         );
00083         $this->assertEquals(
00084             strlen( wfRandomString( 10 ) ), 10
00085         );
00086         $this->assertTrue(
00087             preg_match( '/^[0-9a-f]+$/i', wfRandomString() ) === 1
00088         );
00089     }
00090 
00094     public function testUrlencode() {
00095         $this->assertEquals(
00096             "%E7%89%B9%E5%88%A5:Contributions/Foobar",
00097             wfUrlencode( "\xE7\x89\xB9\xE5\x88\xA5:Contributions/Foobar" ) );
00098     }
00099 
00103     public function testExpandIRI() {
00104         $this->assertEquals(
00105             "https://te.wikibooks.org/wiki/ఉబుంటు_వాడుకరి_మార్గదర్శని",
00106             wfExpandIRI( "https://te.wikibooks.org/wiki/"
00107                 . "%E0%B0%89%E0%B0%AC%E0%B1%81%E0%B0%82%E0%B0%9F%E0%B1%81_"
00108                 . "%E0%B0%B5%E0%B0%BE%E0%B0%A1%E0%B1%81%E0%B0%95%E0%B0%B0%E0%B0%BF_"
00109                 . "%E0%B0%AE%E0%B0%BE%E0%B0%B0%E0%B1%8D%E0%B0%97%E0%B0%A6%E0%B0%B0"
00110                 . "%E0%B1%8D%E0%B0%B6%E0%B0%A8%E0%B0%BF" ) );
00111     }
00112 
00116     public function testReadOnlyEmpty() {
00117         global $wgReadOnly;
00118         $wgReadOnly = null;
00119 
00120         $this->assertFalse( wfReadOnly() );
00121         $this->assertFalse( wfReadOnly() );
00122     }
00123 
00127     public function testReadOnlySet() {
00128         global $wgReadOnly, $wgReadOnlyFile;
00129 
00130         $f = fopen( $wgReadOnlyFile, "wt" );
00131         fwrite( $f, 'Message' );
00132         fclose( $f );
00133         $wgReadOnly = null; # Check on $wgReadOnlyFile
00134 
00135         $this->assertTrue( wfReadOnly() );
00136         $this->assertTrue( wfReadOnly() ); # Check cached
00137 
00138         unlink( $wgReadOnlyFile );
00139         $wgReadOnly = null; # Clean cache
00140 
00141         $this->assertFalse( wfReadOnly() );
00142         $this->assertFalse( wfReadOnly() );
00143     }
00144 
00145     public static function provideArrayToCGI() {
00146         return array(
00147             array( array(), '' ), // empty
00148             array( array( 'foo' => 'bar' ), 'foo=bar' ), // string test
00149             array( array( 'foo' => '' ), 'foo=' ), // empty string test
00150             array( array( 'foo' => 1 ), 'foo=1' ), // number test
00151             array( array( 'foo' => true ), 'foo=1' ), // true test
00152             array( array( 'foo' => false ), '' ), // false test
00153             array( array( 'foo' => null ), '' ), // null test
00154             array( array( 'foo' => 'A&B=5+6@!"\'' ), 'foo=A%26B%3D5%2B6%40%21%22%27' ), // urlencoding test
00155             array(
00156                 array( 'foo' => 'bar', 'baz' => 'is', 'asdf' => 'qwerty' ),
00157                 'foo=bar&baz=is&asdf=qwerty'
00158             ), // multi-item test
00159             array( array( 'foo' => array( 'bar' => 'baz' ) ), 'foo%5Bbar%5D=baz' ),
00160             array(
00161                 array( 'foo' => array( 'bar' => 'baz', 'qwerty' => 'asdf' ) ),
00162                 'foo%5Bbar%5D=baz&foo%5Bqwerty%5D=asdf'
00163             ),
00164             array( array( 'foo' => array( 'bar', 'baz' ) ), 'foo%5B0%5D=bar&foo%5B1%5D=baz' ),
00165             array(
00166                 array( 'foo' => array( 'bar' => array( 'bar' => 'baz' ) ) ),
00167                 'foo%5Bbar%5D%5Bbar%5D=baz'
00168             ),
00169         );
00170     }
00171 
00176     public function testArrayToCGI( $array, $result ) {
00177         $this->assertEquals( $result, wfArrayToCgi( $array ) );
00178     }
00179 
00183     public function testArrayToCGI2() {
00184         $this->assertEquals(
00185             "baz=bar&foo=bar",
00186             wfArrayToCgi(
00187                 array( 'baz' => 'bar' ),
00188                 array( 'foo' => 'bar', 'baz' => 'overridden value' ) ) );
00189     }
00190 
00191     public static function provideCgiToArray() {
00192         return array(
00193             array( '', array() ), // empty
00194             array( 'foo=bar', array( 'foo' => 'bar' ) ), // string
00195             array( 'foo=', array( 'foo' => '' ) ), // empty string
00196             array( 'foo', array( 'foo' => '' ) ), // missing =
00197             array( 'foo=bar&qwerty=asdf', array( 'foo' => 'bar', 'qwerty' => 'asdf' ) ), // multiple value
00198             array( 'foo=A%26B%3D5%2B6%40%21%22%27', array( 'foo' => 'A&B=5+6@!"\'' ) ), // urldecoding test
00199             array( 'foo%5Bbar%5D=baz', array( 'foo' => array( 'bar' => 'baz' ) ) ),
00200             array(
00201                 'foo%5Bbar%5D=baz&foo%5Bqwerty%5D=asdf',
00202                 array( 'foo' => array( 'bar' => 'baz', 'qwerty' => 'asdf' ) )
00203             ),
00204             array( 'foo%5B0%5D=bar&foo%5B1%5D=baz', array( 'foo' => array( 0 => 'bar', 1 => 'baz' ) ) ),
00205             array(
00206                 'foo%5Bbar%5D%5Bbar%5D=baz',
00207                 array( 'foo' => array( 'bar' => array( 'bar' => 'baz' ) ) )
00208             ),
00209         );
00210     }
00211 
00216     public function testCgiToArray( $cgi, $result ) {
00217         $this->assertEquals( $result, wfCgiToArray( $cgi ) );
00218     }
00219 
00220     public static function provideCgiRoundTrip() {
00221         return array(
00222             array( '' ),
00223             array( 'foo=bar' ),
00224             array( 'foo=' ),
00225             array( 'foo=bar&baz=biz' ),
00226             array( 'foo=A%26B%3D5%2B6%40%21%22%27' ),
00227             array( 'foo%5Bbar%5D=baz' ),
00228             array( 'foo%5B0%5D=bar&foo%5B1%5D=baz' ),
00229             array( 'foo%5Bbar%5D%5Bbar%5D=baz' ),
00230         );
00231     }
00232 
00237     public function testCgiRoundTrip( $cgi ) {
00238         $this->assertEquals( $cgi, wfArrayToCgi( wfCgiToArray( $cgi ) ) );
00239     }
00240 
00244     public function testMimeTypeMatch() {
00245         $this->assertEquals(
00246             'text/html',
00247             mimeTypeMatch( 'text/html',
00248                 array( 'application/xhtml+xml' => 1.0,
00249                     'text/html' => 0.7,
00250                     'text/plain' => 0.3 ) ) );
00251         $this->assertEquals(
00252             'text/*',
00253             mimeTypeMatch( 'text/html',
00254                 array( 'image/*' => 1.0,
00255                     'text/*' => 0.5 ) ) );
00256         $this->assertEquals(
00257             '*/*',
00258             mimeTypeMatch( 'text/html',
00259                 array( '*/*' => 1.0 ) ) );
00260         $this->assertNull(
00261             mimeTypeMatch( 'text/html',
00262                 array( 'image/png' => 1.0,
00263                     'image/svg+xml' => 0.5 ) ) );
00264     }
00265 
00269     public function testNegotiateType() {
00270         $this->assertEquals(
00271             'text/html',
00272             wfNegotiateType(
00273                 array( 'application/xhtml+xml' => 1.0,
00274                     'text/html' => 0.7,
00275                     'text/plain' => 0.5,
00276                     'text/*' => 0.2 ),
00277                 array( 'text/html' => 1.0 ) ) );
00278         $this->assertEquals(
00279             'application/xhtml+xml',
00280             wfNegotiateType(
00281                 array( 'application/xhtml+xml' => 1.0,
00282                     'text/html' => 0.7,
00283                     'text/plain' => 0.5,
00284                     'text/*' => 0.2 ),
00285                 array( 'application/xhtml+xml' => 1.0,
00286                     'text/html' => 0.5 ) ) );
00287         $this->assertEquals(
00288             'text/html',
00289             wfNegotiateType(
00290                 array( 'text/html' => 1.0,
00291                     'text/plain' => 0.5,
00292                     'text/*' => 0.5,
00293                     'application/xhtml+xml' => 0.2 ),
00294                 array( 'application/xhtml+xml' => 1.0,
00295                     'text/html' => 0.5 ) ) );
00296         $this->assertEquals(
00297             'text/html',
00298             wfNegotiateType(
00299                 array( 'text/*' => 1.0,
00300                     'image/*' => 0.7,
00301                     '*/*' => 0.3 ),
00302                 array( 'application/xhtml+xml' => 1.0,
00303                     'text/html' => 0.5 ) ) );
00304         $this->assertNull(
00305             wfNegotiateType(
00306                 array( 'text/*' => 1.0 ),
00307                 array( 'application/xhtml+xml' => 1.0 ) ) );
00308     }
00309 
00314     public function testDebugFunctionTest() {
00315 
00316         global $wgDebugLogFile, $wgDebugTimestamps;
00317 
00318         $old_log_file = $wgDebugLogFile;
00319         $wgDebugLogFile = tempnam( wfTempDir(), 'mw-' );
00320         # @todo FIXME: $wgDebugTimestamps should be tested
00321         $old_wgDebugTimestamps = $wgDebugTimestamps;
00322         $wgDebugTimestamps = false;
00323 
00324         wfDebug( "This is a normal string" );
00325         $this->assertEquals( "This is a normal string", file_get_contents( $wgDebugLogFile ) );
00326         unlink( $wgDebugLogFile );
00327 
00328         wfDebug( "This is nöt an ASCII string" );
00329         $this->assertEquals( "This is nöt an ASCII string", file_get_contents( $wgDebugLogFile ) );
00330         unlink( $wgDebugLogFile );
00331 
00332         wfDebug( "\00305This has böth UTF and control chars\003" );
00333         $this->assertEquals(
00334             " 05This has böth UTF and control chars ",
00335             file_get_contents( $wgDebugLogFile )
00336         );
00337         unlink( $wgDebugLogFile );
00338 
00339         wfDebugMem();
00340         $this->assertGreaterThan(
00341             1000,
00342             preg_replace( '/\D/', '', file_get_contents( $wgDebugLogFile ) )
00343         );
00344         unlink( $wgDebugLogFile );
00345 
00346         wfDebugMem( true );
00347         $this->assertGreaterThan(
00348             1000000,
00349             preg_replace( '/\D/', '', file_get_contents( $wgDebugLogFile ) )
00350         );
00351         unlink( $wgDebugLogFile );
00352 
00353         $wgDebugLogFile = $old_log_file;
00354         $wgDebugTimestamps = $old_wgDebugTimestamps;
00355     }
00356 
00360     public function testClientAcceptsGzipTest() {
00361 
00362         $settings = array(
00363             'gzip' => true,
00364             'bzip' => false,
00365             '*' => false,
00366             'compress, gzip' => true,
00367             'gzip;q=1.0' => true,
00368             'foozip' => false,
00369             'foo*zip' => false,
00370             'gzip;q=abcde' => true, //is this REALLY valid?
00371             'gzip;q=12345678.9' => true,
00372             ' gzip' => true,
00373         );
00374 
00375         if ( isset( $_SERVER['HTTP_ACCEPT_ENCODING'] ) ) {
00376             $old_server_setting = $_SERVER['HTTP_ACCEPT_ENCODING'];
00377         }
00378 
00379         foreach ( $settings as $encoding => $expect ) {
00380             $_SERVER['HTTP_ACCEPT_ENCODING'] = $encoding;
00381 
00382             $this->assertEquals( $expect, wfClientAcceptsGzip( true ),
00383                 "'$encoding' => " . wfBoolToStr( $expect ) );
00384         }
00385 
00386         if ( isset( $old_server_setting ) ) {
00387             $_SERVER['HTTP_ACCEPT_ENCODING'] = $old_server_setting;
00388         }
00389     }
00390 
00394     public function testSwapVarsTest() {
00395         $this->hideDeprecated( 'swap' );
00396 
00397         $var1 = 1;
00398         $var2 = 2;
00399 
00400         $this->assertEquals( $var1, 1, 'var1 is set originally' );
00401         $this->assertEquals( $var2, 2, 'var1 is set originally' );
00402 
00403         swap( $var1, $var2 );
00404 
00405         $this->assertEquals( $var1, 2, 'var1 is swapped' );
00406         $this->assertEquals( $var2, 1, 'var2 is swapped' );
00407     }
00408 
00412     public function testWfPercentTest() {
00413 
00414         $pcts = array(
00415             array( 6 / 7, '0.86%', 2, false ),
00416             array( 3 / 3, '1%' ),
00417             array( 22 / 7, '3.14286%', 5 ),
00418             array( 3 / 6, '0.5%' ),
00419             array( 1 / 3, '0%', 0 ),
00420             array( 10 / 3, '0%', -1 ),
00421             array( 3 / 4 / 5, '0.1%', 1 ),
00422             array( 6 / 7 * 8, '6.8571428571%', 10 ),
00423         );
00424 
00425         foreach ( $pcts as $pct ) {
00426             if ( !isset( $pct[2] ) ) {
00427                 $pct[2] = 2;
00428             }
00429             if ( !isset( $pct[3] ) ) {
00430                 $pct[3] = true;
00431             }
00432 
00433             $this->assertEquals( wfPercent( $pct[0], $pct[2], $pct[3] ), $pct[1], $pct[1] );
00434         }
00435     }
00436 
00442     public function testWfShorthandToInteger( $shorthand, $expected ) {
00443         $this->assertEquals( $expected,
00444             wfShorthandToInteger( $shorthand )
00445         );
00446     }
00447 
00449     public static function provideShorthand() {
00450         return array(
00451             # Null, empty ...
00452             array( '', -1 ),
00453             array( '  ', -1 ),
00454             array( null, -1 ),
00455 
00456             # Failures returns 0 :(
00457             array( 'ABCDEFG', 0 ),
00458             array( 'Ak', 0 ),
00459 
00460             # Int, strings with spaces
00461             array( 1, 1 ),
00462             array( ' 1 ', 1 ),
00463             array( 1023, 1023 ),
00464             array( ' 1023 ', 1023 ),
00465 
00466             # kilo, Mega, Giga
00467             array( '1k', 1024 ),
00468             array( '1K', 1024 ),
00469             array( '1m', 1024 * 1024 ),
00470             array( '1M', 1024 * 1024 ),
00471             array( '1g', 1024 * 1024 * 1024 ),
00472             array( '1G', 1024 * 1024 * 1024 ),
00473 
00474             # Negatives
00475             array( -1, -1 ),
00476             array( -500, -500 ),
00477             array( '-500', -500 ),
00478             array( '-1k', -1024 ),
00479 
00480             # Zeroes
00481             array( '0', 0 ),
00482             array( '0k', 0 ),
00483             array( '0M', 0 ),
00484             array( '0G', 0 ),
00485             array( '-0', 0 ),
00486             array( '-0k', 0 ),
00487             array( '-0M', 0 ),
00488             array( '-0G', 0 ),
00489         );
00490     }
00491 
00503     public function testMerge( $old, $mine, $yours, $expectedMergeResult, $expectedText ) {
00504         $this->checkHasDiff3();
00505 
00506         $mergedText = null;
00507         $isMerged = wfMerge( $old, $mine, $yours, $mergedText );
00508 
00509         $msg = 'Merge should be a ';
00510         $msg .= $expectedMergeResult ? 'success' : 'failure';
00511         $this->assertEquals( $expectedMergeResult, $isMerged, $msg );
00512 
00513         if ( $isMerged ) {
00514             // Verify the merged text
00515             $this->assertEquals( $expectedText, $mergedText,
00516                 'is merged text as expected?' );
00517         }
00518     }
00519 
00520     public static function provideMerge() {
00521         $EXPECT_MERGE_SUCCESS = true;
00522         $EXPECT_MERGE_FAILURE = false;
00523 
00524         return array(
00525             // #0: clean merge
00526             array(
00527                 // old:
00528                 "one one one\n" . // trimmed
00529                     "\n" .
00530                     "two two two",
00531 
00532                 // mine:
00533                 "one one one ONE ONE\n" .
00534                     "\n" .
00535                     "two two two\n", // with tailing whitespace
00536 
00537                 // yours:
00538                 "one one one\n" .
00539                     "\n" .
00540                     "two two TWO TWO", // trimmed
00541 
00542                 // ok:
00543                 $EXPECT_MERGE_SUCCESS,
00544 
00545                 // result:
00546                 "one one one ONE ONE\n" .
00547                     "\n" .
00548                     "two two TWO TWO\n", // note: will always end in a newline
00549             ),
00550 
00551             // #1: conflict, fail
00552             array(
00553                 // old:
00554                 "one one one", // trimmed
00555 
00556                 // mine:
00557                 "one one one ONE ONE\n" .
00558                     "\n" .
00559                     "bla bla\n" .
00560                     "\n", // with tailing whitespace
00561 
00562                 // yours:
00563                 "one one one\n" .
00564                     "\n" .
00565                     "two two", // trimmed
00566 
00567                 $EXPECT_MERGE_FAILURE,
00568 
00569                 // result:
00570                 null,
00571             ),
00572         );
00573     }
00574 
00579     public function testMakeUrlIndexes( $url, $expected ) {
00580         $index = wfMakeUrlIndexes( $url );
00581         $this->assertEquals( $expected, $index, "wfMakeUrlIndexes(\"$url\")" );
00582     }
00583 
00584     public static function provideMakeUrlIndexes() {
00585         return array(
00586             array(
00587                 // just a regular :)
00588                 'https://bugzilla.wikimedia.org/show_bug.cgi?id=28627',
00589                 array( 'https://org.wikimedia.bugzilla./show_bug.cgi?id=28627' )
00590             ),
00591             array(
00592                 // mailtos are handled special
00593                 // is this really right though? that final . probably belongs earlier?
00594                 'mailto:[email protected]',
00595                 array( 'mailto:org.wikimedia@wiki.' )
00596             ),
00597 
00598             // file URL cases per bug 28627...
00599             array(
00600                 // three slashes: local filesystem path Unix-style
00601                 'file:///whatever/you/like.txt',
00602                 array( 'file://./whatever/you/like.txt' )
00603             ),
00604             array(
00605                 // three slashes: local filesystem path Windows-style
00606                 'file:///c:/whatever/you/like.txt',
00607                 array( 'file://./c:/whatever/you/like.txt' )
00608             ),
00609             array(
00610                 // two slashes: UNC filesystem path Windows-style
00611                 'file://intranet/whatever/you/like.txt',
00612                 array( 'file://intranet./whatever/you/like.txt' )
00613             ),
00614             // Multiple-slash cases that can sorta work on Mozilla
00615             // if you hack it just right are kinda pathological,
00616             // and unreliable cross-platform or on IE which means they're
00617             // unlikely to appear on intranets.
00618             //
00619             // Those will survive the algorithm but with results that
00620             // are less consistent.
00621 
00622             // protocol-relative URL cases per bug 29854...
00623             array(
00624                 '//bugzilla.wikimedia.org/show_bug.cgi?id=28627',
00625                 array(
00626                     'http://org.wikimedia.bugzilla./show_bug.cgi?id=28627',
00627                     'https://org.wikimedia.bugzilla./show_bug.cgi?id=28627'
00628                 )
00629             ),
00630         );
00631     }
00632 
00637     public function testWfMatchesDomainList( $url, $domains, $expected, $description ) {
00638         $actual = wfMatchesDomainList( $url, $domains );
00639         $this->assertEquals( $expected, $actual, $description );
00640     }
00641 
00642     public static function provideWfMatchesDomainList() {
00643         $a = array();
00644         $protocols = array( 'HTTP' => 'http:', 'HTTPS' => 'https:', 'protocol-relative' => '' );
00645         foreach ( $protocols as $pDesc => $p ) {
00646             $a = array_merge( $a, array(
00647                 array(
00648                     "$p//www.example.com",
00649                     array(),
00650                     false,
00651                     "No matches for empty domains array, $pDesc URL"
00652                 ),
00653                 array(
00654                     "$p//www.example.com",
00655                     array( 'www.example.com' ),
00656                     true,
00657                     "Exact match in domains array, $pDesc URL"
00658                 ),
00659                 array(
00660                     "$p//www.example.com",
00661                     array( 'example.com' ),
00662                     true,
00663                     "Match without subdomain in domains array, $pDesc URL"
00664                 ),
00665                 array(
00666                     "$p//www.example2.com",
00667                     array( 'www.example.com', 'www.example2.com', 'www.example3.com' ),
00668                     true,
00669                     "Exact match with other domains in array, $pDesc URL"
00670                 ),
00671                 array(
00672                     "$p//www.example2.com",
00673                     array( 'example.com', 'example2.com', 'example3,com' ),
00674                     true,
00675                     "Match without subdomain with other domains in array, $pDesc URL"
00676                 ),
00677                 array(
00678                     "$p//www.example4.com",
00679                     array( 'example.com', 'example2.com', 'example3,com' ),
00680                     false,
00681                     "Domain not in array, $pDesc URL"
00682                 ),
00683                 array(
00684                     "$p//nds-nl.wikipedia.org",
00685                     array( 'nl.wikipedia.org' ),
00686                     false,
00687                     "Non-matching substring of domain, $pDesc URL"
00688                 ),
00689             ) );
00690         }
00691 
00692         return $a;
00693     }
00694 
00698     public function testWfMkdirParents() {
00699         // Should not return true if file exists instead of directory
00700         $fname = $this->getNewTempFile();
00701         wfSuppressWarnings();
00702         $ok = wfMkdirParents( $fname );
00703         wfRestoreWarnings();
00704         $this->assertFalse( $ok );
00705     }
00706 
00711     public function testWfShellMaintenanceCmd( $script, $parameters, $options,
00712         $expected, $description
00713     ) {
00714         if ( wfIsWindows() ) {
00715             // Approximation that's good enough for our purposes just now
00716             $expected = str_replace( "'", '"', $expected );
00717         }
00718         $actual = wfShellMaintenanceCmd( $script, $parameters, $options );
00719         $this->assertEquals( $expected, $actual, $description );
00720     }
00721 
00722     public static function provideWfShellMaintenanceCmdList() {
00723         global $wgPhpCli;
00724 
00725         return array(
00726             array( 'eval.php', array( '--help', '--test' ), array(),
00727                 "'$wgPhpCli' 'eval.php' '--help' '--test'",
00728                 "Called eval.php --help --test" ),
00729             array( 'eval.php', array( '--help', '--test space' ), array( 'php' => 'php5' ),
00730                 "'php5' 'eval.php' '--help' '--test space'",
00731                 "Called eval.php --help --test with php option" ),
00732             array( 'eval.php', array( '--help', '--test', 'X' ), array( 'wrapper' => 'MWScript.php' ),
00733                 "'$wgPhpCli' 'MWScript.php' 'eval.php' '--help' '--test' 'X'",
00734                 "Called eval.php --help --test with wrapper option" ),
00735             array(
00736                 'eval.php',
00737                 array( '--help', '--test', 'y' ),
00738                 array( 'php' => 'php5', 'wrapper' => 'MWScript.php' ),
00739                 "'php5' 'MWScript.php' 'eval.php' '--help' '--test' 'y'",
00740                 "Called eval.php --help --test with wrapper and php option"
00741             ),
00742         );
00743     }
00744     /* @todo many more! */
00745 }