/** * @depends testMarshall21 */ public function testMarshallNoOutputMinStrings20() { // Make sure no output for minStrings in a QTI 2.0 context. $hottext = new Hottext('hottext1'); $hottext->setContent(new InlineStaticCollection(array(new TextRun('hot')))); $div = new Div(); $div->setContent(new FlowCollection(array(new TextRun('This is a '), new Hottext('hot1'), new TextRun(' text...')))); $content = new BlockStaticCollection(array($div)); $hottextInteraction = new HottextInteraction('RESPONSE', $content); $hottextInteraction->setMinChoices(1); $element = $this->getMarshallerFactory('2.0.0')->createMarshaller($hottextInteraction)->marshall($hottextInteraction); $dom = new DOMDocument('1.0', 'UTF-8'); $element = $dom->importNode($element, true); $this->assertEquals('<hottextInteraction responseIdentifier="RESPONSE"><div>This is a <hottext identifier="hot1"/> text...</div></hottextInteraction>', $dom->saveXML($element)); }
public function testMarshall() { $hottext = new Hottext('hottext1'); $hottext->setContent(new InlineStaticCollection(array(new TextRun('hot')))); $div = new Div(); $div->setContent(new FlowCollection(array(new TextRun('This is a '), new Hottext('hot1'), new TextRun(' text...')))); $content = new BlockStaticCollection(array($div)); $hottextInteraction = new HottextInteraction('RESPONSE', $content); $prompt = new Prompt(); $prompt->setContent(new FlowStaticCollection(array(new TextRun('Prompt...')))); $hottextInteraction->setPrompt($prompt); $element = $this->getMarshallerFactory()->createMarshaller($hottextInteraction)->marshall($hottextInteraction); $dom = new DOMDocument('1.0', 'UTF-8'); $element = $dom->importNode($element, true); $this->assertEquals('<hottextInteraction responseIdentifier="RESPONSE"><prompt>Prompt...</prompt><div>This is a <hottext identifier="hot1"/> text...</div></hottextInteraction>', $dom->saveXML($element)); }
public static function buildSimple($identifier, $contentMap) { $interactionContent = new BlockStaticCollection(); $p = new P(); $pCollection = new InlineCollection(); foreach ($contentMap as $content) { if (is_array($content)) { $hottext = new Hottext(key($content)); $hottextContent = new InlineStaticCollection(); $hottextContent->attach(new TextRun($content[key($content)])); $hottext->setContent($hottextContent); $pCollection->attach($hottext); } else { if (is_string($content)) { $pCollection->attach(new TextRun($content)); } } } $p->setContent($pCollection); $interactionContent->attach($p); return new HottextInteraction($identifier, $interactionContent); }
public function testMarshall() { $hottext = new Hottext('choice1', 'my-hottext1', 'so hot'); $hottext->setFixed(true); $hottext->setShowHide(ShowHide::HIDE); $hottext->setTemplateIdentifier('tpl1'); $hottext->setContent(new InlineStaticCollection(array(new TextRun('Choice1')))); $element = $this->getMarshallerFactory('2.1.0')->createMarshaller($hottext)->marshall($hottext); $dom = new DOMDocument('1.0', 'UTF-8'); $element = $dom->importNode($element, true); $this->assertEquals('<hottext id="my-hottext1" class="so hot" identifier="choice1" fixed="true" templateIdentifier="tpl1" showHide="hide">Choice1</hottext>', $dom->saveXML($element)); }