/** * @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 testSkippingForbidden() { $itemSession = self::instantiateBasicAssessmentItemSession(); $itemSessionControl = new ItemSessionControl(); $itemSessionControl->setAllowSkipping(false); $itemSession->setItemSessionControl($itemSessionControl); $itemSession->beginItemSession(); $itemSession->beginAttempt(); try { $itemSession->skip(); $this->assertTrue(false); } catch (AssessmentItemSessionException $e) { $this->assertEquals(AssessmentItemSessionException::SKIPPING_FORBIDDEN, $e->getCode()); } }