public function postRequest(SS_HTTPRequest $request, SS_HTTPResponse $response, DataModel $model) { if (!$this->testSessionEnvironment->isRunningTests()) { return; } // Store PHP session $state = $this->testSessionEnvironment->getState(); $state->session = Session::get_all(); $this->testSessionEnvironment->applyState($state); }
/** * As with {@link self::start()}, if you want to extend the functionality of this, then look at * {@link TestSessionEnvironent::endTestSession()} as the extension points have moved to there now that the logic * is there. */ public function end() { if (!$this->environment->isRunningTests()) { throw new LogicException("No test session in progress."); } $this->environment->endTestSession(); Session::clear('TestSessionId'); // Clear out all PHP session states which have been set previously if ($sessionStates = Session::get('_TestSessionController.BrowserSessionState')) { foreach ($sessionStates as $k => $v) { Session::clear($k); } Session::clear('_TestSessionController'); } return $this->renderWith('TestSession_end'); }