/**
 * 
 *
 * @internal revisions
 */
function getTestCaseSetFromSimpleXMLObj($xmlTCs)
{
    $tcSet = null;
    if (!$xmlTCs) {
        return $tcSet;
    }
    $jdx = 0;
    $loops2do = sizeof($xmlTCs);
    $tcaseSet = array();
    // $tcXML['elements'] = array('string' => array("summary","preconditions"),
    //             'integer' => array("node_order","externalid","execution_type","importance"));
    // $tcXML['attributes'] = array('string' => array("name"), 'integer' =>array('internalid'));
    // TICKET 4963: Test case / Tes suite XML format, new element to set author
    $tcXML['elements'] = array('string' => array("summary" => null, "preconditions" => null, "author_login" => null, "estimated_exec_duration" => null), 'integer' => array("node_order" => null, "externalid" => null, "status" => null, "execution_type" => null, "importance" => null));
    $tcXML['attributes'] = array('string' => array("name" => 'trim'), 'integer' => array('internalid' => null));
    for ($idx = 0; $idx < $loops2do; $idx++) {
        $dummy = getItemsFromSimpleXMLObj(array($xmlTCs[$idx]), $tcXML);
        $tc = $dummy[0];
        if ($tc) {
            // Test Case Steps
            $steps = getStepsFromSimpleXMLObj($xmlTCs[$idx]->steps->step);
            $tc['steps'] = $steps;
            $keywords = getKeywordsFromSimpleXMLObj($xmlTCs[$idx]->keywords->keyword);
            if ($keywords) {
                $tc['keywords'] = $keywords;
            }
            $cf = getCustomFieldsFromSimpleXMLObj($xmlTCs[$idx]->custom_fields->custom_field);
            if ($cf) {
                $tc['customfields'] = $cf;
            }
            $requirements = getRequirementsFromSimpleXMLObj($xmlTCs[$idx]->requirements->requirement);
            if ($requirements) {
                $tc['requirements'] = $requirements;
            }
        }
        $tcaseSet[$jdx++] = $tc;
    }
    return $tcaseSet;
}
Esempio n. 2
0
/**
 * 
 *
 * @internal revisions
 * 20100317 - added internalid - BUGID 3236
 */
function getTestCaseSetFromSimpleXMLObj($xmlTCs)
{
    $tcSet = null;
    if (!$xmlTCs) {
        return $tcSet;
    }
    $jdx = 0;
    $loops2do = sizeof($xmlTCs);
    $tcaseSet = array();
    $tcXML['elements'] = array('string' => array("summary", "preconditions"), 'integer' => array("node_order", "externalid", "execution_type", "importance"));
    $tcXML['attributes'] = array('string' => array("name"), 'integer' => array('internalid'));
    for ($idx = 0; $idx < $loops2do; $idx++) {
        $dummy = getItemsFromSimpleXMLObj(array($xmlTCs[$idx]), $tcXML);
        $tc = $dummy[0];
        if ($tc) {
            // Test Case Steps
            $steps = getStepsFromSimpleXMLObj($xmlTCs[$idx]->steps->step);
            $tc['steps'] = $steps;
            $keywords = getKeywordsFromSimpleXMLObj($xmlTCs[$idx]->keywords->keyword);
            if ($keywords) {
                $tc['keywords'] = $keywords;
            }
            $cf = getCustomFieldsFromSimpleXMLObj($xmlTCs[$idx]->custom_fields->custom_field);
            if ($cf) {
                $tc['customfields'] = $cf;
            }
            $requirements = getRequirementsFromSimpleXMLObj($xmlTCs[$idx]->requirements->requirement);
            if ($requirements) {
                $tc['requirements'] = $requirements;
            }
        }
        $tcaseSet[$jdx++] = $tc;
    }
    return $tcaseSet;
}