/** * * Adds a test case instance into the test procedure data * @param KalturaTestCaseInstanceData $testCaseInstance */ public function addTestCaseInstance(KalturaTestCaseInstanceData $testCaseInstance) { if ($this->testCasesData == null) { $this->testCasesData = array(); } $name = $testCaseInstance->getTestCaseInstanceName(); $this->testCasesData["{$name}"] = $testCaseInstance; }
/** * * Returns the given KalturaTestCaseInstanceData as a DomDocument * @param KalturaTestCaseInstanceData $testCaseInstanceData */ public static function toXml(KalturaTestCaseInstanceData $testCaseInstanceData) { $dom = new DOMDocument("1.0"); //Create all his elements $domTestCaseData = $dom->createElement("TestCaseData"); $domTestCaseData->setAttribute("testCaseInstanceName", $testCaseInstanceData->getTestCaseInstanceName()); $dom->appendChild($domTestCaseData); //For each input: foreach ($testCaseInstanceData->getInput() as $input) { //Create the xml from the object $objectAsDOM = KalturaTestDataObject::toXml($input, "Input"); kXml::appendDomToElement($objectAsDOM, $domTestCaseData, $dom); } //For each outputReference: foreach ($testCaseInstanceData->getOutputReferences() as $outputReference) { //Create the xml from the object $objectAsDOM = KalturaTestDataObject::toXml($outputReference, "OutputReference"); kXml::appendDomToElement($objectAsDOM, $domTestCaseData, $dom); } return $dom; }