From d5f89dad49d5f5cd0f655919994637b43ae90f9b Mon Sep 17 00:00:00 2001 From: bugalot Date: Wed, 5 Aug 2015 10:31:10 +0200 Subject: [PATCH] AssessmentTestSession::jumpTo() did not suspend current item session. --- composer.json | 2 +- qtism/runtime/tests/AssessmentTestSession.php | 4 ++++ test/qtism/runtime/tests/AssessmentTestSessionTest.php | 5 +++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 10ab09332..edb9e11a2 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "qtism/qtism", "description": "OAT QTI Software Module Library", "type": "library", - "version": "0.9.10", + "version": "0.9.11", "authors": [ { "name": "Open Assessment Technologies S.A.", diff --git a/qtism/runtime/tests/AssessmentTestSession.php b/qtism/runtime/tests/AssessmentTestSession.php index 81f683ef2..c3b4aaf28 100644 --- a/qtism/runtime/tests/AssessmentTestSession.php +++ b/qtism/runtime/tests/AssessmentTestSession.php @@ -1304,6 +1304,7 @@ public function jumpTo($position, $allowTimeout = false) { throw new AssessmentTestSessionException($msg, AssessmentTestSessionException::FORBIDDEN_JUMP); } + $this->suspendItemSession(); $route = $this->getRoute(); $oldPosition = $route->getPosition(); @@ -1315,6 +1316,9 @@ public function jumpTo($position, $allowTimeout = false) { if ($allowTimeout === false) { $this->checkTimeLimits(false, true); } + + // No exception thrown, interact! + $this->interactWithItemSession(); } catch (AssessmentTestSessionException $e) { // Rollback to previous position. diff --git a/test/qtism/runtime/tests/AssessmentTestSessionTest.php b/test/qtism/runtime/tests/AssessmentTestSessionTest.php index daae87cac..9c7a1daff 100644 --- a/test/qtism/runtime/tests/AssessmentTestSessionTest.php +++ b/test/qtism/runtime/tests/AssessmentTestSessionTest.php @@ -674,7 +674,12 @@ public function testJumps() { // Moving to Q03 and answer it. $session->jumpTo(2); + + // Check that session for Q01 is suspended after jump. + $Q01s = $session->getAssessmentItemSessions('Q01'); + $this->assertEquals(AssessmentItemSessionState::SUSPENDED, $Q01s[0]->getState()); $this->assertEquals('Q03', $session->getCurrentAssessmentItemRef()->getIdentifier()); + $session->beginAttempt(); $session->endAttempt(new State(array(new ResponseVariable('RESPONSE', Cardinality::MULTIPLE, BaseType::IDENTIFIER, new MultipleContainer(BaseType::IDENTIFIER, array(new Identifier('H'), new Identifier('O'))))))); $session->moveNext();