public function testStoreTestVariable()
 {
     $deliveryResultIdentifier = "MyDeliveryResultIdentifier#1";
     $test = "MyGreatTest#3";
     $callId = "MyCallId#3";
     $testVariable = new \taoResultServer_models_classes_OutcomeVariable();
     $testVariable->setBaseType('float');
     $testVariable->setCardinality('multiple');
     $testVariable->setEpoch(microtime());
     $testVariable->setIdentifier('TestIdentifier');
     $testVariable->setValue('MyValue');
     $this->instance->storeTestVariable($deliveryResultIdentifier, $test, $testVariable, $callId);
     $tmp = $this->instance->getVariable($callId, 'TestIdentifier');
     $object = array_shift($tmp)[0];
     $this->assertEquals($test, $object->test);
     $this->assertNull($object->item);
     $this->assertEquals('float', $object->variable->getBaseType());
     $this->assertEquals('multiple', $object->variable->getCardinality());
     $this->assertEquals('TestIdentifier', $object->variable->getIdentifier());
     $this->assertEquals('MyValue', $object->variable->getValue());
     $this->assertInstanceOf('taoResultServer_models_classes_OutcomeVariable', $object->variable);
     $this->assertEquals('float', $this->instance->getVariableProperty($object->uri, 'baseType'));
     $this->assertEquals('multiple', $this->instance->getVariableProperty($object->uri, 'cardinality'));
     $this->assertEquals('TestIdentifier', $this->instance->getVariableProperty($object->uri, 'identifier'));
     $this->assertEquals('MyValue', $this->instance->getVariableProperty($object->uri, 'value'));
 }
 /**
  * Transmit a test-level QtiSm Runtime Variable to the target Result Server as a test result.
  * 
  * @param mixed $variable An OutcomeVariable object to be transmitted to the target Result Server.
  * @param string $transmissionId A unique identifier that identifies uniquely the visited test.
  * @param string $testUri An optional URL that identifies uniquely the test the $variable comes from.
  */
 public function transmitTestVariable($variable, $transmissionId, $testUri = '')
 {
     $resultVariable = new taoResultServer_models_classes_OutcomeVariable();
     $resultVariable->setIdentifier($variable->getIdentifier());
     $resultVariable->setBaseType(BaseType::getNameByConstant($variable->getBaseType()));
     $resultVariable->setCardinality(Cardinality::getNameByConstant($variable->getCardinality()));
     $value = $variable->getValue();
     $resultVariable->setValue(self::transformValue($value));
     try {
         $this->getResultServer()->storeTestVariable($testUri, $resultVariable, $transmissionId);
     } catch (Exception $e) {
         $msg = "An error occured while transmitting a Response Variable to the target result server.";
         $code = taoQtiCommon_helpers_ResultTransmissionException::OUTCOME;
         throw new taoQtiCommon_helpers_ResultTransmissionException($msg, $code);
     }
 }
Esempio n. 3
0
 $rs->storeRelatedTestTaker($deliverIdentifier, "MyTestTaker#" . $i);
 $rs->storeRelatedDelivery($deliverIdentifier, "MyDelivery#" . $i);
 //        $deliveryResult = $rs->storeDeliveryResult($deliverIdentifier);
 //        $rs->storeTestTaker($deliveryResult, "MyTestTaker#".$i);
 //        $rs->storeDelivery($deliveryResult,"MyDelivery#".$i);
 $test = "myTestid" . $i;
 // Create ItemVariables then store them
 for ($j = 0; $j < 10; $j++) {
     if ($j < 3) {
         $itemVariable = new taoResultServer_models_classes_OutcomeVariable();
         $itemVariable->setNormalMaximum("123" . $i . $j);
         $itemVariable->setNormalMinimum("Maximum" . $i . $j);
         $itemVariable->setValue("MyValue" . $i . $j);
         $itemVariable->setIdentifier("identifier" . $i . $j);
         $itemVariable->setCardinality("single");
         $itemVariable->setBaseType("float");
     } else {
         $itemVariable = new taoResultServer_models_classes_ResponseVariable();
         $itemVariable->setCandidateResponse("[Jerome Awesome]");
         $itemVariable->setCorrectResponse("[nop,plop]");
         $itemVariable->setIdentifier("identifier" . $i . $j);
         $itemVariable->setCardinality("single");
         $itemVariable->setBaseType("pair");
     }
     $callIdItem = "An identifier of the execution of an item occurence for a test taker#" . $j;
     $item = "anotherId#" . $j;
     $rs->storeItemVariable($deliverIdentifier, $test, $item, $itemVariable, $callIdItem);
     //            $rs->storeItemVariable($deliveryResult, $test, $item, $itemVariable, $callIdItem);
 }
 $callIdTest = "Great Test Id#134589";
 $testVariable = new taoResultServer_models_classes_ResponseVariable();