// 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'];
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
$testResourceFiles = array(); // an array containing all the resource files needed for this test
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 );
}
if ( isset( $_GET['clearTestSuite'] ) ) {
$testSuiteName = getTestSuiteNameFromCookie( $cookieName );
- $expire = time() - 600;
+ $expire = time() - 600;
setcookie(
$cookieName,
'',
$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
$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'] ) ) {
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;
}
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 );