Index: trunk/phase3/maintenance/tests/selenium/selenium_settings.ini.php52.sample |
— | — | @@ -0,0 +1,19 @@ |
| 2 | +[browsers] |
| 3 | + |
| 4 | +firefox = "*firefox" |
| 5 | +iexploreproxy = "*iexploreproxy" |
| 6 | +chrome = "*chrome" |
| 7 | + |
| 8 | +[SeleniumSettings] |
| 9 | + |
| 10 | +host = "localhost" |
| 11 | +port = "4444" |
| 12 | +wikiUrl = "http://localhost/mediawiki/latest_trunk/trunk/phase3" |
| 13 | +username = "Wikiadmin" |
| 14 | +userPassword = "Wikiadminpw" |
| 15 | +testBrowser = "firefox" |
| 16 | + |
| 17 | +[testSuite] |
| 18 | + |
| 19 | +SimpleSeleniumTestSuite = "maintenance/tests/selenium/SimpleSeleniumTestSuite.php" |
| 20 | +PagedTiffHandlerSeleniumTestSuite = "extensions/PagedTiffHandler/selenium/PagedTiffHandlerTestSuite.php" |
Index: trunk/phase3/maintenance/tests/selenium/SeleniumConfig.php |
— | — | @@ -10,6 +10,7 @@ |
11 | 11 | * See sample config file in selenium_settings.ini.sample |
12 | 12 | * |
13 | 13 | */ |
| 14 | + |
14 | 15 | public static function getSeleniumSettings ( &$seleniumSettings, |
15 | 16 | &$seleniumBrowsers, |
16 | 17 | &$seleniumTestSuites, |
— | — | @@ -23,7 +24,16 @@ |
24 | 25 | throw new MWException( "Unable to read local Selenium Settings from " . $seleniumConfigFile . "\n" ); |
25 | 26 | } |
26 | 27 | |
27 | | - $configArray = parse_ini_file($seleniumConfigFile, true); |
| 28 | + if ( !defined( 'PHP_VERSION_ID' ) || |
| 29 | + ( PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 3 ) ) { |
| 30 | + $configArray = self::parse_5_2_ini_file( $seleniumConfigFile ); |
| 31 | + } else { |
| 32 | + $configArray = parse_ini_file( $seleniumConfigFile, true ); |
| 33 | + } |
| 34 | + if ( $configArray === false ) { |
| 35 | + throw new MWException( "Error parsing " . $seleniumConfigFile . "\n" ); |
| 36 | + } |
| 37 | + |
28 | 38 | if ( array_key_exists( 'SeleniumSettings', $configArray) ) { |
29 | 39 | wfSuppressWarnings(); |
30 | 40 | //we may need to change how this is set. But for now leave it in the ini file |
— | — | @@ -45,4 +55,28 @@ |
46 | 56 | return true; |
47 | 57 | } |
48 | 58 | |
| 59 | + private static function parse_5_2_ini_file ( $ConfigFile ) { |
| 60 | + |
| 61 | + $configArray = parse_ini_file( $ConfigFile, true ); |
| 62 | + if ( $configArray === false ) return false; |
| 63 | + |
| 64 | + // PHP 5.2 ini files have [browsers] and [testSuite] sections |
| 65 | + // to get around lack of support for array keys. It then |
| 66 | + // inserts the section arrays into the appropriate places in |
| 67 | + // the SeleniumSettings and SeleniumTests arrays. |
| 68 | + |
| 69 | + if ( isset( $configArray[browsers] ) ) { |
| 70 | + $configArray[SeleniumSettings][browsers] = $configArray[browsers]; |
| 71 | + unset ( $configArray[browsers] ); |
| 72 | + } |
| 73 | + |
| 74 | + if ( isset( $configArray[testSuite] ) ) { |
| 75 | + $configArray[SeleniumTests][testSuite] = $configArray[testSuite]; |
| 76 | + unset ( $configArray[testSuite] ); |
| 77 | + } |
| 78 | + |
| 79 | + return $configArray; |
| 80 | + |
| 81 | + } |
| 82 | + |
49 | 83 | } |