/** * Add a variable to be transformed into its IMS PCI JSON Representation * for a later output. * * @param Variable $variable */ public function addVariable(Variable $variable) { $output =& $this->getOutput(); $varName = $variable->getIdentifier(); $marshaller = new taoQtiCommon_helpers_PciJsonMarshaller(); $output[$varName] = $marshaller->marshall($variable->getValue(), taoQtiCommon_helpers_PciJsonMarshaller::MARSHALL_ARRAY); }
public function testMarshallFile() { $file = $this->getFile(); $marshaller = new taoQtiCommon_helpers_PciJsonMarshaller(); $json = $marshaller->marshall($file); $this->assertEquals(array('base' => array('file' => array('mime' => taoQtiCommon_helpers_PciJsonMarshaller::FILE_PLACEHOLDER_MIMETYPE, 'data' => base64_encode(taoQtiCommon_helpers_PciJsonMarshaller::FILE_PLACEHOLDER_DATA)))), json_decode($json, true)); }