diff options
Diffstat (limited to 'includes/SeleniumWebSettings.php')
-rw-r--r-- | includes/SeleniumWebSettings.php | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/includes/SeleniumWebSettings.php b/includes/SeleniumWebSettings.php index 7b98568d..7715484e 100644 --- a/includes/SeleniumWebSettings.php +++ b/includes/SeleniumWebSettings.php @@ -38,7 +38,7 @@ $cookieName = $cookiePrefix . 'Selenium'; // this is a fallback SQL file $testSqlFile = false; $testImageZip = false; - + // if we find a request parameter containing the test name, set a cookie with the test name if ( isset( $_GET['setupTestSuite'] ) ) { $setupTestSuiteName = $_GET['setupTestSuite']; @@ -62,9 +62,9 @@ if ( isset( $_GET['setupTestSuite'] ) ) { true ); } - + $testIncludes = array(); // array containing all the includes needed for this test - $testGlobalConfigs = array(); // an array containg all the global configs needed for this test + $testGlobalConfigs = array(); // an array containing all the global configs needed for this test $testResourceFiles = array(); // an array containing all the resource files needed for this test $callback = $wgSeleniumTestConfigs[$setupTestSuiteName]; call_user_func_array( $callback, array( &$testIncludes, &$testGlobalConfigs, &$testResourceFiles)); @@ -72,11 +72,11 @@ if ( isset( $_GET['setupTestSuite'] ) ) { if ( isset( $testResourceFiles['images'] ) ) { $testImageZip = $testResourceFiles['images']; } - + if ( isset( $testResourceFiles['db'] ) ) { $testSqlFile = $testResourceFiles['db']; $testResourceName = getTestResourceNameFromTestSuiteName( $setupTestSuiteName ); - + switchToTestResources( $testResourceName, false ); // false means do not switch database yet setupTestResources( $testResourceName, $testSqlFile, $testImageZip ); } @@ -86,7 +86,7 @@ if ( isset( $_GET['setupTestSuite'] ) ) { if ( isset( $_GET['clearTestSuite'] ) ) { $testSuiteName = getTestSuiteNameFromCookie( $cookieName ); - $expire = time() - 600; + $expire = time() - 600; setcookie( $cookieName, '', @@ -96,22 +96,22 @@ if ( isset( $_GET['clearTestSuite'] ) ) { $wgCookieSecure, true ); - + $testResourceName = getTestResourceNameFromTestSuiteName( $testSuiteName ); teardownTestResources( $testResourceName ); } // if a cookie is found, run the appropriate callback to get the config params. -if ( isset( $_COOKIE[$cookieName] ) ) { +if ( isset( $_COOKIE[$cookieName] ) ) { $testSuiteName = getTestSuiteNameFromCookie( $cookieName ); if ( !isset( $wgSeleniumTestConfigs[$testSuiteName] ) ) { return; } - + $testIncludes = array(); // array containing all the includes needed for this test - $testGlobalConfigs = array(); // an array containg all the global configs needed for this test + $testGlobalConfigs = array(); // an array containing all the global configs needed for this test $testResourceFiles = array(); // an array containing all the resource files needed for this test - $callback = $wgSeleniumTestConfigs[$testSuiteName]; + $callback = $wgSeleniumTestConfigs[$testSuiteName]; call_user_func_array( $callback, array( &$testIncludes, &$testGlobalConfigs, &$testResourceFiles)); if ( isset( $testResourceFiles['db'] ) ) { @@ -123,9 +123,8 @@ if ( isset( $_COOKIE[$cookieName] ) ) { require_once( $file ); } foreach ( $testGlobalConfigs as $key => $value ) { - if ( is_array( $value ) ) { + if ( is_array( $value ) ) { $GLOBALS[$key] = array_merge( $GLOBALS[$key], $value ); - } else { $GLOBALS[$key] = $value; } @@ -166,7 +165,7 @@ function setupTestResources( $testResourceName, $testSqlFile, $testImageZip ) { if ( $testResourceName == '' ) { die( 'Cannot identify a test the resources should be installed for.' ); } - + // create tables $dbw = wfGetDB( DB_MASTER ); $dbw->query( 'DROP DATABASE IF EXISTS ' . $testResourceName ); |