Пример #1
0
 /**
  * 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);
 }
Пример #2
0
 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));
 }