Skip to content

Commit

Permalink
AssessmentTestSession::jumpTo() did not suspend current item session.
Browse files Browse the repository at this point in the history
  • Loading branch information
bugalot committed Aug 5, 2015
1 parent 926cc8b commit d5f89da
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
4 changes: 4 additions & 0 deletions qtism/runtime/tests/AssessmentTestSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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.
Expand Down
5 changes: 5 additions & 0 deletions test/qtism/runtime/tests/AssessmentTestSessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit d5f89da

Please sign in to comment.