Esempio n. 1
0
    }
    if (count($var_cases) == 0) {
        echo "<script>alert('文件中没有找到测试例定义数据,请检查!');self.location.href='/lib/dcnTplanCase/tplanCaseView.php?id={$tplan_id}&name={$tplan_name}&divindex={$divindex}' ;</script>";
        exit;
    }
} else {
    echo "<script>alert('别逗,你上传的不是确认2.0 var文件或确认3.0 prj文件或导出的.testlink文件!');self.location.href='/lib/dcnTplanCase/tplanCaseView.php?id={$tplan_id}&name={$tplan_name}&divindex={$divindex}' ;</script>";
    exit;
}
//testlink_cases
$platform_mgr = new tlPlatform($db, $args->testproject_id);
$tcase_mgr = new testcase($db);
if ($suite == 'testlink') {
    $testlink_cases = $platform_mgr->getTplanDeviceCaseScript($tplan_id, $device_id);
} else {
    $testlink_cases = $platform_mgr->getTplanDeviceCases($tplan_id, $device_id, $suite);
}
$gui = new stdClass();
$gui->needadd = array_diff($var_cases, $testlink_cases[0]);
$needdelete = array_diff($testlink_cases[0], $var_cases);
$gui->candelete = array_diff($testlink_cases[1], $var_cases);
$gui->cannotdelete = array_diff($needdelete, $gui->candelete);
$gui->added = $gui->deleted = array();
if (!is_null($gui->needadd)) {
    foreach ($gui->needadd as $case) {
        $rs = $tcase_mgr->modifyTplanDeviceCases($tplan_id, $device_id, $suite, $case, "add", $user_name);
        if ($rs == 'Success') {
            $gui->added[] = $case;
        }
    }
}