http://www.mediawiki.org/wiki/Special:Code/MediaWiki/73381
Revision: 73381
Author: platonides
Date: 2010-09-20 15:38:04 +0000 (Mon, 20 Sep 2010)
Log Message:
-----------
Follow up r72799, using MW_INSTALL_PATH and moving the logic to find
maintenance/commandLine.inc to a common file.
Modified Paths:
--------------
trunk/extensions/Maps/test/MapsCoordinateParserTest.php
trunk/extensions/Maps/test/MapsDistanceParserTest.php
Added Paths:
-----------
trunk/extensions/Maps/test/commandLine.inc
Modified: trunk/extensions/Maps/test/MapsCoordinateParserTest.php
===================================================================
--- trunk/extensions/Maps/test/MapsCoordinateParserTest.php 2010-09-20
14:34:39 UTC (rev 73380)
+++ trunk/extensions/Maps/test/MapsCoordinateParserTest.php 2010-09-20
15:38:04 UTC (rev 73381)
@@ -1,14 +1,8 @@
<?php
require_once 'PHPUnit/Framework/TestCase.php';
+require_once dirname(__FILE__) . '/commandLine.inc';
-// Trick MW into thinking this is a command line script.
-// This is obviously not a good approach, as it will not work on other setups
then my own.
-unset( $_SERVER['REQUEST_METHOD'] );
-$argv = array( 'over9000failz' );
-( include dirname(__FILE__) . '/../../../phase3/maintenance/commandLine.inc' )
or
-require_once '../../../smw/maintenance/commandLine.inc';
-
/**
* MapsCoordinateParser test case.
*
Modified: trunk/extensions/Maps/test/MapsDistanceParserTest.php
===================================================================
--- trunk/extensions/Maps/test/MapsDistanceParserTest.php 2010-09-20
14:34:39 UTC (rev 73380)
+++ trunk/extensions/Maps/test/MapsDistanceParserTest.php 2010-09-20
15:38:04 UTC (rev 73381)
@@ -1,14 +1,8 @@
<?php
require_once 'PHPUnit/Framework/TestCase.php';
+require_once dirname(__FILE__) . '/commandLine.inc';
-// Trick MW into thinking this is a command line script.
-// This is obviously not a good approach, as it will not work on other setups
then my own.
-unset( $_SERVER['REQUEST_METHOD'] );
-$argv = array( 'over9000failz' );
-( include dirname(__FILE__) . '/../../../phase3/maintenance/commandLine.inc' )
or
-require_once '../../../smw/maintenance/commandLine.inc';
-
/**
* MapsDistanceParser test case.
*
Added: trunk/extensions/Maps/test/commandLine.inc
===================================================================
--- trunk/extensions/Maps/test/commandLine.inc (rev 0)
+++ trunk/extensions/Maps/test/commandLine.inc 2010-09-20 15:38:04 UTC (rev
73381)
@@ -0,0 +1,23 @@
+<?php
+
+// Trick MW into thinking this is a command line script.
+// This is obviously not a good approach, as it will not work on other setups
then my own.
+unset( $_SERVER['REQUEST_METHOD'] );
+$argv = array( 'over9000failz' );
+$optionsWithArgs = array();
+if ( count( $_REQUEST ) ) {
+ die( "This is a pseudo-command line script" );
+}
+
+if ( getenv( 'MW_INSTALL_PATH' ) !== false ) {
+ $IP = getenv( 'MW_INSTALL_PATH' );
+} else {
+ foreach( array( '../../../phase3', '../../../smw' ) as $rel ) {
+ if ( file_exists( dirname( __FILE__ ) .
"/$rel/maintenance/commandLine.inc" ) ) {
+ $IP = dirname( __FILE__ ) . "/$rel";
+ break;
+ }
+ }
+}
+require( "$IP/maintenance/commandLine.inc" );
+
Property changes on: trunk/extensions/Maps/test/commandLine.inc
___________________________________________________________________
Added: svn:eol-style
+ native
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs