/** * * Write the outpur data for the test * @param KalturaTypeReflector $outputTypeReflector */ protected function setOutputData($outputTypeReflector, &$testParams, &$testValues, $isBase = false, &$validateValues = null) { $paramType = $outputTypeReflector->getType(); $paramName = $outputTypeReflector->getName(); $this->writeXmlSource("\t\t\t\t<OutputReference name = '{$paramName}' type = '{$paramType}' key = 'Fill the object key' />"); if ($outputTypeReflector->isSimpleType() || $outputTypeReflector->isEnum() || $outputTypeReflector->isDynamicEnum() || $outputTypeReflector->isDynamicEnum()) { $defaultValue = $outputTypeReflector->getDefaultValue(); $this->writeIni("test1.reference = " . $defaultValue); $this->writeXml("\t\t<OutputReference name = '{$paramName}' type = '{$paramType}' key = '{$defaultValue}' />"); } elseif ($outputTypeReflector->isFile()) { $this->writeIni("test1.reference.objectType = file"); $this->writeIni("test1.reference.path = "); //TODO: add support for files in XML $this->writeXml("\t\t<OutputReference name = '{$paramName}' type='file' key='path/to/file'/>"); } else { $this->writeIni("test1.reference.objectType = {$paramType}"); $this->writeXml("\t\t<OutputReference name = '{$paramName}' type = '{$paramType}' key = 'object key'>"); $actionParamProperties = $outputTypeReflector->getTypeReflector()->getProperties(); foreach ($actionParamProperties as $actionParamProperty) { /* @var $actionParamProperty KalturaPropertyInfo */ if ($actionParamProperty->isReadOnly()) { continue; } $propertyType = $actionParamProperty->getType(); $propertyName = $actionParamProperty->getName(); if ($actionParamProperty->isSimpleType() || $actionParamProperty->isEnum() || $actionParamProperty->isDynamicEnum() || $actionParamProperty->isDynamicEnum()) { $paramDefaultValue = $actionParamProperty->getDefaultValue(); $this->writeIni("test1.reference.{$propertyName} = " . $paramDefaultValue); $this->writeXml("\t\t\t<{$propertyName}>{$paramDefaultValue}</{$propertyName}>"); } elseif ($actionParamProperty->isFile()) { $this->writeIni("test1.reference.{$propertyName}.objectType = file"); $this->writeIni("test1.reference.{$propertyName}.path = "); //TODO: add support for files in XML $this->writeXml("\t\t\t<OutputReference name = '{$paramName}' type='file' key= 'path/to/file'>"); } elseif (!$actionParamProperty->isAbstract()) { if ($propertyName == 'type') { //Causes bug in the Zend config $this->writeIni("test1.reference.objType.{$propertyName} = {$propertyType}"); } else { $this->writeIni("test1.reference.{$propertyName}.objectType = {$propertyType}"); } $this->writeXml("\t\t\t<{$propertyName}>{$propertyType}</{$propertyName}>"); } } $this->writeXml("\t\t</OutputReference>"); } $paramDesc = strlen($outputTypeReflector->getDescription()) ? ' ' . $outputTypeReflector->getDescription() : ''; if ($isBase) { $this->writeBase("\t * @param {$paramType} \$reference{$paramDesc}"); } else { $this->writeTest("\t * @param {$paramType} \$reference{$paramDesc}"); } if (!$outputTypeReflector->isComplexType() || $outputTypeReflector->isEnum() || $outputTypeReflector->isStringEnum() || $outputTypeReflector->isDynamicEnum()) { $testParam = "\$reference"; } else { $testParam = "{$paramType} \$reference"; } if ($outputTypeReflector->isOptional()) { if ($outputTypeReflector->getDefaultValue()) { if ($outputTypeReflector->getType() == 'string') { $testParam .= " = '" . $outputTypeReflector->getDefaultValue() . "'"; } else { $testParam .= " = " . $outputTypeReflector->getDefaultValue(); } } else { $testParam .= " = null"; } } $testParams[] = $testParam; if ($isBase) { $validateValues[] = "\$reference"; } else { //write to TestFile $testValues[] = "\$reference"; } }