Index: trunk/extensions/Maps/test/MapsCoordinateParserTest.php |
— | — | @@ -1,14 +1,8 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | require_once 'PHPUnit/Framework/TestCase.php'; |
| 5 | +require_once dirname(__FILE__) . '/commandLine.inc'; |
5 | 6 | |
6 | | -// Trick MW into thinking this is a command line script. |
7 | | -// This is obviously not a good approach, as it will not work on other setups then my own. |
8 | | -unset( $_SERVER['REQUEST_METHOD'] ); |
9 | | -$argv = array( 'over9000failz' ); |
10 | | -( include dirname(__FILE__) . '/../../../phase3/maintenance/commandLine.inc' ) or |
11 | | -require_once '../../../smw/maintenance/commandLine.inc'; |
12 | | - |
13 | 7 | /** |
14 | 8 | * MapsCoordinateParser test case. |
15 | 9 | * |
Index: trunk/extensions/Maps/test/MapsDistanceParserTest.php |
— | — | @@ -1,14 +1,8 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | require_once 'PHPUnit/Framework/TestCase.php'; |
| 5 | +require_once dirname(__FILE__) . '/commandLine.inc'; |
5 | 6 | |
6 | | -// Trick MW into thinking this is a command line script. |
7 | | -// This is obviously not a good approach, as it will not work on other setups then my own. |
8 | | -unset( $_SERVER['REQUEST_METHOD'] ); |
9 | | -$argv = array( 'over9000failz' ); |
10 | | -( include dirname(__FILE__) . '/../../../phase3/maintenance/commandLine.inc' ) or |
11 | | -require_once '../../../smw/maintenance/commandLine.inc'; |
12 | | - |
13 | 7 | /** |
14 | 8 | * MapsDistanceParser test case. |
15 | 9 | * |
Index: trunk/extensions/Maps/test/commandLine.inc |
— | — | @@ -0,0 +1,23 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +// Trick MW into thinking this is a command line script. |
| 5 | +// This is obviously not a good approach, as it will not work on other setups then my own. |
| 6 | +unset( $_SERVER['REQUEST_METHOD'] ); |
| 7 | +$argv = array( 'over9000failz' ); |
| 8 | +$optionsWithArgs = array(); |
| 9 | +if ( count( $_REQUEST ) ) { |
| 10 | + die( "This is a pseudo-command line script" ); |
| 11 | +} |
| 12 | + |
| 13 | +if ( getenv( 'MW_INSTALL_PATH' ) !== false ) { |
| 14 | + $IP = getenv( 'MW_INSTALL_PATH' ); |
| 15 | +} else { |
| 16 | + foreach( array( '../../../phase3', '../../../smw' ) as $rel ) { |
| 17 | + if ( file_exists( dirname( __FILE__ ) . "/$rel/maintenance/commandLine.inc" ) ) { |
| 18 | + $IP = dirname( __FILE__ ) . "/$rel"; |
| 19 | + break; |
| 20 | + } |
| 21 | + } |
| 22 | +} |
| 23 | +require( "$IP/maintenance/commandLine.inc" ); |
| 24 | + |
Property changes on: trunk/extensions/Maps/test/commandLine.inc |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 25 | + native |