function tearDown() { Context::set(); // Nullify the context for next run. TestingConfiguration::tearDownConfiguration(); // And the default config }
function resetAllEnv() { $_SESSION = array(); $_GET = array(); $_POST = array(); $_SERVER = array(); $_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1'; $_SERVER['HTTP_HOST'] = TESTS_HOSTNAME; $_SERVER['SERVER_NAME'] = TESTS_HOSTNAME; $_SERVER['SCRIPT_NAME'] = __FILE__; RequestContext::resetMain(); // Wipe out the $instance of these classes to make sure they're // re-created with fresh gateway instances for the next test $singleton_classes = array('Gateway_Extras_ConversionLog', 'Gateway_Extras_CustomFilters', 'Gateway_Extras_CustomFilters_Functions', 'Gateway_Extras_CustomFilters_IP_Velocity', 'Gateway_Extras_CustomFilters_MinFraud', 'Gateway_Extras_CustomFilters_Referrer', 'Gateway_Extras_CustomFilters_Source', 'Gateway_Extras_SessionVelocityFilter'); foreach ($singleton_classes as $singleton_class) { $unwrapped = TestingAccessWrapper::newFromClass($singleton_class); $unwrapped->instance = null; } // Reset SmashPig context Context::set(null); }