public function testMarshall() { $choice = new InlineChoice('choice1', 'my-choice1'); $choice->setContent(new TextOrVariableCollection(array(new PrintedVariable('pr1')))); $choice->setFixed(true); $choice->setTemplateIdentifier('tpl1'); $choice->setShowHide(ShowHide::HIDE); $element = $this->getMarshallerFactory()->createMarshaller($choice)->marshall($choice); $dom = new DOMDocument('1.0', 'UTF-8'); $element = $dom->importNode($element, true); $this->assertEquals('<inlineChoice id="my-choice1" identifier="choice1" fixed="true" templateIdentifier="tpl1" showHide="hide"><printedVariable identifier="pr1" base="10" powerForm="false" delimiter=";" mappingIndicator="="/></inlineChoice>', $dom->saveXML($element)); }
public function testMarshall20() { // check that suffled systematically out and no required attribute. $inlineChoices = new InlineChoiceCollection(); $choice = new InlineChoice('inlineChoice1'); $choice->setFixed(true); $choice->setContent(new TextOrVariableCollection(array(new TextRun('Option1')))); $inlineChoices[] = $choice; $inlineChoiceInteraction = new InlineChoiceInteraction('RESPONSE', $inlineChoices); $inlineChoiceInteraction->setShuffle(false); $inlineChoiceInteraction->setRequired(true); $element = $this->getMarshallerFactory('2.0.0')->createMarshaller($inlineChoiceInteraction)->marshall($inlineChoiceInteraction); $dom = new DOMDocument('1.0', 'UTF-8'); $element = $dom->importNode($element, true); $this->assertEquals('<inlineChoiceInteraction responseIdentifier="RESPONSE" shuffle="false"><inlineChoice identifier="inlineChoice1" fixed="true">Option1</inlineChoice></inlineChoiceInteraction>', $dom->saveXML($element)); }
public function testMarshall() { $inlineChoices = new InlineChoiceCollection(); $choice = new InlineChoice('inlineChoice1'); $choice->setFixed(true); $choice->setContent(new TextOrVariableCollection(array(new TextRun('Option1')))); $inlineChoices[] = $choice; $choice = new InlineChoice('inlineChoice2'); $choice->setContent(new TextOrVariableCollection(array(new TextRun('Option2')))); $inlineChoices[] = $choice; $choice = new InlineChoice('inlineChoice3'); $choice->setContent(new TextOrVariableCollection(array(new TextRun('Option3')))); $inlineChoices[] = $choice; $inlineChoiceInteraction = new InlineChoiceInteraction('RESPONSE', $inlineChoices); $inlineChoiceInteraction->setShuffle(true); $inlineChoiceInteraction->setRequired(true); $element = $this->getMarshallerFactory()->createMarshaller($inlineChoiceInteraction)->marshall($inlineChoiceInteraction); $dom = new DOMDocument('1.0', 'UTF-8'); $element = $dom->importNode($element, true); $this->assertEquals('<inlineChoiceInteraction responseIdentifier="RESPONSE" shuffle="true" required="true"><inlineChoice identifier="inlineChoice1" fixed="true">Option1</inlineChoice><inlineChoice identifier="inlineChoice2">Option2</inlineChoice><inlineChoice identifier="inlineChoice3">Option3</inlineChoice></inlineChoiceInteraction>', $dom->saveXML($element)); }