public function testFromInvalidObject() { $this->setExpectedException('\\InvalidArgumentException'); $component = new stdClass(); $factory = new Qti21MarshallerFactory(); $marshaller = $factory->createMarshaller($component); }
public static function marshallValidQti(QtiComponent $component) { $marshallerFactory = new Qti21MarshallerFactory(); $marshaller = $marshallerFactory->createMarshaller($component); $element = $marshaller->marshall($component); $dom = new \DOMDocument(); $dom->preserveWhiteSpace = false; $dom->formatOutput = false; $node = $dom->importNode($element, true); return $dom->saveXML($node); }