models/classes/runner/QtiRunnerService.php
public function init(RunnerServiceContext $context)
    {
        if ($context instanceof QtiRunnerServiceContext) {
            /* @var TestSession $session */
            $session = $context->getTestSession();

            // code borrowed from the previous implementation, but the reset timers option has been discarded
            if ($session->getState() === AssessmentTestSessionState::INITIAL) {
                // The test has just been instantiated.
                $session->beginTestSession();
                $event = new TestInitEvent($session);
                $this->getServiceManager()->get(EventManager::SERVICE_ID)->trigger($event);
                \common_Logger::i("Assessment Test Session begun.");

                if ($context->isAdaptive()) {
                    \common_Logger::t("Very first item is adaptive.");
                    $nextCatItemId = $context->selectAdaptiveNextItem();
                    $context->persistCurrentCatItemId($nextCatItemId);
                    $context->persistSeenCatItemIds($nextCatItemId);
                }
            } elseif ($session->getState() === AssessmentTestSessionState::SUSPENDED) {
                $session->resume();
            }

            $session->initItemTimer();
            if ($session->isTimeout() === false) {
                TestRunnerUtils::beginCandidateInteraction($session);
            }

            $this->getServiceManager()->get(ExtendedStateService::SERVICE_ID)->clearEvents($session->getSessionId());
        } else {
            throw new \common_exception_InvalidArgumentType(
                'QtiRunnerService',
                'init',
                0,
                'oat\taoQtiTest\models\runner\QtiRunnerServiceContext',
                $context
            );
        }

        return true;
    }
public function init(RunnerServiceContext $context)
    {
        if ($context instanceof QtiRunnerServiceContext) {
            /* @var TestSession $session */
            $session = $context->getTestSession();

            // code borrowed from the previous implementation, but the reset timers option has been discarded
            if ($session->getState() === AssessmentTestSessionState::INITIAL) {
                // The test has just been instantiated.
                $session->beginTestSession();
                $event = new TestInitEvent($session);
                $this->getServiceManager()->get(EventManager::SERVICE_ID)->trigger($event);
                \common_Logger::i("Assessment Test Session begun.");

                if ($context->isAdaptive()) {
                    \common_Logger::t("Very first item is adaptive.");
                    $nextCatItemId = $context->selectAdaptiveNextItem();
                    $context->persistCurrentCatItemId($nextCatItemId);
                    $context->persistSeenCatItemIds($nextCatItemId);
                }
            } elseif ($session->getState() === AssessmentTestSessionState::SUSPENDED) {
                $session->resume();
            }

            $session->initItemTimer();
            if ($session->isTimeout() === false) {
                TestRunnerUtils::beginCandidateInteraction($session);
            }

            $this->getServiceManager()->get(ExtendedStateService::SERVICE_ID)->clearEvents($session->getSessionId());
        } else {
            throw new \common_exception_InvalidArgumentType(
                'QtiRunnerService',
                'init',
                0,
                'oat\taoQtiTest\models\runner\QtiRunnerServiceContext',
                $context
            );
        }

        return true;
    }
Initializes the delivery execution session

This method is called whenever a candidate enters the test. This includes

* Newly launched/instantiated test session.
* The candidate refreshes the client (F5).
* Resumed test sessions.

@param RunnerServiceContext $context
@return boolean
@throws \common_Exception