Skip to content

Commit

Permalink
Merge pull request #21 from boajer/master
Browse files Browse the repository at this point in the history
Marshalling sequence changed, in order to be compatibale with xsd schema
  • Loading branch information
Jérôme Bogaerts committed Nov 16, 2015
2 parents 98b23ce + a0d3737 commit 292c553
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,16 @@ protected function marshall(QtiComponent $component)
self::setDOMElementAttribute($element, 'toolVersion', $component->getToolVersion());
}

if ($component->hasTimeLimits() === true) {
$marshaller = $this->getMarshallerFactory()->createMarshaller($component->getTimeLimits());
$element->appendChild($marshaller->marshall($component->getTimeLimits()));
}

foreach ($component->getOutcomeDeclarations() as $outcomeDeclaration) {
$marshaller = $this->getMarshallerFactory()->createMarshaller($outcomeDeclaration);
$element->appendChild($marshaller->marshall($outcomeDeclaration));
}

if ($component->hasTimeLimits() === true) {
$marshaller = $this->getMarshallerFactory()->createMarshaller($component->getTimeLimits());
$element->appendChild($marshaller->marshall($component->getTimeLimits()));
}

foreach ($component->getTestParts() as $part) {
$marshaller = $this->getMarshallerFactory()->createMarshaller($part);
$element->appendChild($marshaller->marshall($part));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ public function testMarshallMaximal() {

$dom = new DOMDocument('1.0', 'UTF-8');
$element = $dom->importNode($element, true);
$this->assertEquals('<assessmentTest identifier="test1" title="A Test" toolName="qtisdk" toolVersion="0.0.0"><timeLimits maxTime="600" allowLateSubmission="false"/><outcomeDeclaration identifier="COUNT" cardinality="single" baseType="integer"/><testPart identifier="part1" navigationMode="linear" submissionMode="individual"><preCondition><baseValue baseType="boolean">true</baseValue></preCondition><branchRule target="EXIT_TESTPART"><baseValue baseType="boolean">true</baseValue></branchRule><itemSessionControl maxAttempts="1" showFeedback="false" allowReview="true" showSolution="true" allowComment="false" allowSkipping="true" validateResponses="false"/><timeLimits maxTime="100" allowLateSubmission="false"/><assessmentSection identifier="section1" required="false" fixed="false" title="My Section 1" visible="true" keepTogether="true"/><assessmentSection identifier="section2" required="false" fixed="false" title="My Section 2" visible="true" keepTogether="true"/><testFeedback access="atEnd" outcomeIdentifier="show" showHide="show" identifier="feedback1" title="hello!"><p>Prima!</p></testFeedback><testFeedbackRef identifier="feedback1" outcomeIdentifier="show" access="atEnd" showHide="show" href="./TF01.xml"/></testPart><outcomeProcessing><setOutcomeValue identifier="COUNT"><baseValue baseType="integer">1</baseValue></setOutcomeValue></outcomeProcessing><testFeedback access="atEnd" outcomeIdentifier="show" showHide="show" identifier="feedbackTest" title="hello!"><p>Good!</p></testFeedback><testFeedbackRef identifier="feedbackTest" outcomeIdentifier="show" access="atEnd" showHide="show" href="./TF02.xml"/></assessmentTest>', $dom->saveXML($element));
$this->assertEquals('<assessmentTest identifier="test1" title="A Test" toolName="qtisdk" toolVersion="0.0.0"><outcomeDeclaration identifier="COUNT" cardinality="single" baseType="integer"/><timeLimits maxTime="600" allowLateSubmission="false"/><testPart identifier="part1" navigationMode="linear" submissionMode="individual"><preCondition><baseValue baseType="boolean">true</baseValue></preCondition><branchRule target="EXIT_TESTPART"><baseValue baseType="boolean">true</baseValue></branchRule><itemSessionControl maxAttempts="1" showFeedback="false" allowReview="true" showSolution="true" allowComment="false" allowSkipping="true" validateResponses="false"/><timeLimits maxTime="100" allowLateSubmission="false"/><assessmentSection identifier="section1" required="false" fixed="false" title="My Section 1" visible="true" keepTogether="true"/><assessmentSection identifier="section2" required="false" fixed="false" title="My Section 2" visible="true" keepTogether="true"/><testFeedback access="atEnd" outcomeIdentifier="show" showHide="show" identifier="feedback1" title="hello!"><p>Prima!</p></testFeedback><testFeedbackRef identifier="feedback1" outcomeIdentifier="show" access="atEnd" showHide="show" href="./TF01.xml"/></testPart><outcomeProcessing><setOutcomeValue identifier="COUNT"><baseValue baseType="integer">1</baseValue></setOutcomeValue></outcomeProcessing><testFeedback access="atEnd" outcomeIdentifier="show" showHide="show" identifier="feedbackTest" title="hello!"><p>Good!</p></testFeedback><testFeedbackRef identifier="feedbackTest" outcomeIdentifier="show" access="atEnd" showHide="show" href="./TF02.xml"/></assessmentTest>', $dom->saveXML($element));
}

public function testUnmarshallMaximal() {
$dom = new DOMDocument('1.0', 'UTF-8');
$dom->loadXML(
'<assessmentTest identifier="test1" title="A Test" toolName="qtisdk" toolVersion="0.0.0">
<timeLimits maxTime="600" allowLateSubmission="false"/>
<outcomeDeclaration identifier="COUNT" cardinality="single" baseType="integer"/>
<timeLimits maxTime="600" allowLateSubmission="false"/>
<testPart identifier="part1" navigationMode="linear" submissionMode="individual">
<preCondition>
<baseValue baseType="boolean">true</baseValue>
Expand Down

0 comments on commit 292c553

Please sign in to comment.