/**
  * @see \qtism\data\storage\xml\marshalling\Marshaller::unmarshall()
  */
 protected function unmarshall(DOMElement $element)
 {
     $object = new ItemSessionControl();
     if (($value = static::getDOMElementAttributeAs($element, 'maxAttempts', 'integer')) !== null) {
         $object->setMaxAttempts($value);
     }
     if (($value = static::getDOMElementAttributeAs($element, 'showFeedback', 'boolean')) !== null) {
         $object->setShowFeedback($value);
     }
     if (($value = static::getDOMElementAttributeAs($element, 'allowReview', 'boolean')) !== null) {
         $object->setAllowReview($value);
     }
     if (($value = static::getDOMElementAttributeAs($element, 'showSolution', 'boolean')) !== null) {
         $object->setShowSolution($value);
     }
     if (($value = static::getDOMElementAttributeAs($element, 'allowComment', 'boolean')) !== null) {
         $object->setAllowComment($value);
     }
     if (($value = static::getDOMElementAttributeAs($element, 'allowSkipping', 'boolean')) !== null) {
         $object->setAllowSkipping($value);
     }
     if (($value = static::getDOMElementAttributeAs($element, 'validateResponses', 'boolean')) !== null) {
         $object->setValidateResponses($value);
     }
     return $object;
 }
 public function testModalFeedback()
 {
     $doc = new XmlDocument('2.1.0');
     $doc->load(self::samplesDir() . 'ims/items/2_1/modalFeedback.xml');
     $itemSession = new AssessmentItemSession($doc->getDocumentComponent());
     $itemSessionControl = new ItemSessionControl();
     $itemSessionControl->setShowFeedback(true);
     $itemSessionControl->setMaxAttempts(0);
     $itemSession->setItemSessionControl($itemSessionControl);
     $itemSession->beginItemSession();
     $responses = new State(array(new ResponseVariable('RESPONSE', Cardinality::SINGLE, BaseType::IDENTIFIER, new Identifier('true'))));
     $itemSession->beginAttempt();
     $itemSession->endAttempt($responses);
     $this->assertEquals('correct', $itemSession['FEEDBACK']->getValue());
     $this->assertEquals(AssessmentItemSessionState::MODAL_FEEDBACK, $itemSession->getState());
     // new attempt!
     $responses = new State(array(new ResponseVariable('RESPONSE', Cardinality::SINGLE, BaseType::IDENTIFIER, new Identifier('false'))));
     $itemSession->beginAttempt();
     $itemSession->endAttempt($responses);
     $this->assertEquals('incorrect', $itemSession['FEEDBACK']->getValue());
     $this->assertEquals(AssessmentItemSessionState::MODAL_FEEDBACK, $itemSession->getState());
     $itemSession->endItemSession();
     $this->assertEquals('completed', $itemSession['completionStatus']->getValue());
 }