/** * Does some complementary stuff to finish the action. Builds the test context object and binds it to the response. * @param bool $withContext */ protected function afterAction($withContext = true) { $testSession = $this->getTestSession(); $sessionId = $testSession->getSessionId(); // Build assessment test context. $ctx = taoQtiTest_helpers_TestRunnerUtils::buildAssessmentTestContext($this->getTestSession(), $this->getTestMeta(), $this->getRequestParameter('QtiTestDefinition'), $this->getRequestParameter('QtiTestCompilation'), $this->getRequestParameter('standalone'), $this->getCompilationDirectory()); // add a flag to allow distinction with error responses $ctx['success'] = true; // Put the assessment test context in request data. $this->setData('assessmentTestContext', $ctx); if ($withContext === true) { // Output only if requested by client-code. echo json_encode($ctx); } common_Logger::i("Persisting QTI Assessment Test Session '{$sessionId}'..."); $this->getStorage()->persist($testSession); }