public function testParametricAssessmentTestSessionCreation() { $acceptableLatency = new Duration('PT5S'); $considerMinTime = false; $manager = new SessionManager(); $manager->setAcceptableLatency($acceptableLatency); $manager->setConsiderMinTime($considerMinTime); $session = $manager->createAssessmentTestSession($this->getTest()); $this->assertInstanceOf('qtism\\runtime\\tests\\AssessmentTestSession', $session); $this->assertFalse($session->mustConsiderMinTime()); $this->assertTrue($session->getAcceptableLatency()->equals(new Duration('PT5S')), 'The custom acceptable latency must be PT5S'); }
/** * Instantiate a basic item session for an adaptive, non-timeDependent item with two variables: * * * RESPONSE (single, identifier, correctResponse = 'ChoiceB' * * SCORE (single, float, defaultValue = 0.0) * * The responseProcessing sets: * * * SCORE to 0, completionStatus to 'incomplete', if the response is not 'ChoiceB'. * * SCORE to 1, completionStatus to 'complete', if the response is 'ChoiceB'. * * @return \qtism\runtime\tests\AssessmentItemSession */ protected static function instantiateBasicAdaptiveAssessmentItem(Duration $acceptableLatency = null) { $itemRef = self::createExtendedAssessmentItemRefFromXml(' <assessmentItemRef identifier="Q01" href="./Q01.xml" adaptive="true" timeDependent="false"> <responseDeclaration identifier="RESPONSE" cardinality="single" baseType="identifier"> <correctResponse> <value>ChoiceB</value> </correctResponse> </responseDeclaration> <outcomeDeclaration identifier="SCORE" cardinality="single" baseType="float"> <defaultValue> <value>0.0</value> </defaultValue> </outcomeDeclaration> <!-- The candidate is allowed to attempt the item until he provides the correct answer --> <responseProcessing> <responseCondition> <responseIf> <match> <variable identifier="RESPONSE"/> <baseValue baseType="identifier">ChoiceB</baseValue> </match> <setOutcomeValue identifier="SCORE"> <baseValue baseType="float">1</baseValue> </setOutcomeValue> <setOutcomeValue identifier="completionStatus"> <baseValue baseType="identifier">completed</baseValue> </setOutcomeValue> </responseIf> <responseElse> <setOutcomeValue identifier="SCORE"> <baseValue baseType="float">0</baseValue> </setOutcomeValue> <setOutcomeValue identifier="completionStatus"> <baseValue baseType="identifier">incomplete</baseValue> </setOutcomeValue> </responseElse> </responseCondition> </responseProcessing> </assessmentItemRef> '); $manager = new SessionManager(); if (is_null($acceptableLatency) === false) { $manager->setAcceptableLatency($acceptableLatency); } return new AssessmentItemSession($itemRef, $manager); }