public function init($testcase) { $this->expected = array(); $this->testcase = $testcase; $this->verified = false; ApiProxy::setApiProxy($this); }
// Set SCRIPT_NAME to SCRIPT_FILENAME made relative to DOCUMENT_ROOT and // PHP_SELF to SCRIPT_NAME except when the script is included in PATH_INFO ( // REQUEST_URI without the query string) which matches Apache behavior. $_SERVER['SCRIPT_NAME'] = substr($_SERVER['SCRIPT_FILENAME'], strlen($_SERVER['DOCUMENT_ROOT'])); if (strpos($_SERVER['PATH_INFO'], $_SERVER['SCRIPT_NAME']) === 0) { $_SERVER['PHP_SELF'] = $_SERVER['PATH_INFO']; } else { $_SERVER['PHP_SELF'] = $_SERVER['SCRIPT_NAME']; } }; $setupApiProxy = function () { global $unsetEnv; if (!function_exists('make_call')) { require_once 'google/appengine/runtime/ApiProxy.php'; require_once 'google/appengine/runtime/RemoteApiProxy.php'; \google\appengine\runtime\ApiProxy::setApiProxy(new \google\appengine\runtime\RemoteApiProxy(getenv('REMOTE_API_HOST'), getenv('REMOTE_API_PORT'), getenv('REMOTE_REQUEST_ID'))); $unsetEnv('REMOTE_API_HOST'); $unsetEnv('REMOTE_API_PORT'); $unsetEnv('REMOTE_REQUEST_ID'); } }; $setupBuiltins = function () { require_once 'google/appengine/runtime/Setup.php'; }; $setupAPC = function () { /** * On the development AppServer users may not have APC available, especially * if they built the php-cgi binary themselves. Provide stub functions here * so we don't need to complicate the logic later by checking if the * functions are avaialble. */
protected function setUp() { stream_wrapper_unregister("http"); stream_wrapper_register("http", __NAMESPACE__ . '\\MockHttpStream'); ApiProxy::setApiProxy(new VmApiProxy()); // Clear out any MockHttp calls. unset($GLOBALS['mock_http']); // Standard environment variables putenv(VmApiProxy::TICKET_HEADER . '=' . self::$rpc_default_options['ticket']); }