validate(); $ref = $this->getRequestParameter('ref') ?: null; $scope = $this->getRequestParameter('scope'); $start = ($this->getRequestParameter('start') !== false); try { $serviceContext = $this->getServiceContext(); $this->saveToolStates(); if (!$this->getRunnerService()->isTerminated($serviceContext)) { $this->endItemTimer($this->getTime()); $this->saveItemState(); } $this->initServiceContext(); $this->saveItemResponses(); if ($this->getRequestParameter('offline') === true) { $this->setOffline(); } $result = $this->getRunnerService()->timeout($serviceContext, $scope, $ref); $response = [ 'success' => $result, ]; if ($result) { $response['testContext'] = $this->getRunnerService()->getTestContext($serviceContext); if ($serviceContext->containsAdaptive()) { // Force map update. $response['testMap'] = $this->getRunnerService()->getTestMap($serviceContext, true); } } if ($start == true) { // start the timer only when move starts the item session // and after context build to avoid timing error $this->getRunnerService()->startTimer($serviceContext, $this->getTime()); } } catch (Exception $e) { $response = $this->getErrorResponse($e); } return $response; } /** * Scope is a required fields. * * @return array */ protected function getRequiredFields() { return array_merge(parent::getRequiredFields(), ['scope']); } }