Script calling cleanups
authorPlatonides <platonides@gmail.com>
Mon, 25 Feb 2013 20:09:38 +0000 (21:09 +0100)
committerPlatonides <platonides@gmail.com>
Mon, 25 Feb 2013 22:11:51 +0000 (23:11 +0100)
· Use env(1) in shebangs instead of hardcoding paths.
· $IP is already set in the constructor of Maintenance classes.
· Add sapi guard to some phpunit files.

Change-Id: I6c6fd6c61e2861b5992f2ccd67a4e3f62e2c445e

includes/normal/UtfNormalTest2.php
tests/RunSeleniumTests.php
tests/phpunit/includes/api/generateRandomImages.php
tests/phpunit/phpunit.php
tests/qunit/data/generateJqueryMsgData.php
tests/qunit/data/load.mock.php
tests/selenium/installer/MediaWikiInstallerTestSuite.php

index f4a8379..2266696 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/php
+#!/usr/bin/env php
 <?php
 /**
  * Other tests for the unicode normalization module.
index 716a8db..6e212eb 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/php
+#!/usr/bin/env php
 <?php
 /**
  * @file
  * http://www.gnu.org/copyleft/gpl.html
  */
 
-$IP = dirname( __DIR__ );
+if ( PHP_SAPI != 'cli' ) {
+       die( "Run me from the command line please.\n" );
+}
 
 define( 'SELENIUMTEST', true );
 
-//require_once( __DIR__ . '/../maintenance/commandLine.inc' );
 require( __DIR__ . '/../maintenance/Maintenance.php' );
 
 require_once( 'PHPUnit/Runner/Version.php' );
index cba8312..bdd15c4 100644 (file)
@@ -5,11 +5,8 @@
  * @file
  */
 
-// Evaluate the include path relative to this file
-$IP = dirname( dirname( dirname( dirname( __DIR__ ) ) ) );
-
 // Start up MediaWiki in command-line mode
-require_once( "$IP/maintenance/Maintenance.php" );
+require_once( __DIR__ . "/../../../../maintenance/Maintenance.php" );
 require( __DIR__ . "/RandomImageGenerator.php" );
 
 class GenerateRandomImages extends Maintenance {
index 2a0298a..cce5dde 100755 (executable)
@@ -8,14 +8,11 @@
 
 /* Configuration */
 
-// Evaluate the include path relative to this file
-$IP = dirname( dirname( __DIR__ ) );
-
 // Set a flag which can be used to detect when other scripts have been entered through this entry point or not
 define( 'MW_PHPUNIT_TEST', true );
 
 // Start up MediaWiki in command-line mode
-require_once( "$IP/maintenance/Maintenance.php" );
+require_once( dirname( dirname( __DIR__ ) ) . "/maintenance/Maintenance.php" );
 
 class PHPUnitMaintClass extends Maintenance {
 
index 774000b..604ede8 100644 (file)
@@ -61,9 +61,7 @@
  * </code>
  */
 
-$maintenanceDir = dirname( dirname( dirname( __DIR__ ) ) ) . '/maintenance';
-
-require( "$maintenanceDir/Maintenance.php" );
+require( __DIR__ . '/../../../maintenance/Maintenance.php' );
 
 class GenerateJqueryMsgData extends Maintenance {
 
@@ -149,4 +147,4 @@ class GenerateJqueryMsgData extends Maintenance {
 }
 
 $maintClass = "GenerateJqueryMsgData";
-require_once( "$maintenanceDir/doMaintenance.php" );
+require_once( RUN_MAINTENANCE_IF_MAIN );
index 1c18970..7ff392a 100644 (file)
@@ -24,7 +24,7 @@
  */
 header( 'Content-Type: text/javascript; charset=utf-8' );
 
-require_once '../../../includes/Xml.php';
+require_once __DIR__ . '/../../../includes/Xml.php';
 
 $moduleImplementations = array(
        'testUsesMissing' => "
index 1356ce6..f179113 100644 (file)
@@ -1,5 +1,4 @@
 <?php
-
 /**
  * MediaWikiInstallerTestSuite
  *
  *
  */
 
+if ( PHP_SAPI != 'cli' ) {
+       die( "Run me from the command line please.\n" );
+}
+
 require_once 'PHPUnit/Framework/TestSuite.php';
 
 require_once ( __DIR__ . '/MediaWikiUserInterfaceTestCase.php' );