本文整理汇总了PHP中testcase::create_tcversion方法的典型用法代码示例。如果您正苦于以下问题:PHP testcase::create_tcversion方法的具体用法?PHP testcase::create_tcversion怎么用?PHP testcase::create_tcversion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类testcase
的用法示例。
在下文中一共展示了testcase::create_tcversion方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: migrate_tc_specs
function migrate_tc_specs(&$source_db, &$target_db, &$tmp_table_name, &$users, &$migrator)
{
$first_version = 1;
$tc_mgr = new testcase($target_db);
$map_tc_tcversion = array();
$admin_id = 1;
$items_processed = 0;
// how many records are we going to tackle at a time
// with basic benchmarking roughly 500 seemed to be slightly faster
$step_amt = 500;
print_msg("<b><center>Migrating Test Cases - Part I - " . date("H:i:s") . " -</center></b><br>");
$tc_count = $migrator->get_tmp_table_count();
// Make sure we have enough memory to do what we are about to do
check_memory($tc_count);
// testcase nodes have to be done separately from tcversions because the version
// inserts a new node
while ($items_processed < $tc_count) {
$query = "SELECT * FROM {$tmp_table_name} ORDER BY id LIMIT {$items_processed},{$step_amt}";
$items = $source_db->fetchRowsIntoMap($query, 'id');
foreach ($items as $item_id => $idata) {
// 20061208 - franciscom -
// added abs()
// added htmlentities()
print_msg("TCID:{$item_id} - " . htmlentities($idata['title']) . "<br>");
$status = $tc_mgr->create_tcase_only(0, $idata['title'], abs($idata['TCorder']), $item_id);
++$items_processed;
if ($items_processed % FEEDBACK_STEP == 0) {
print_msg('<br><span class="processed">Part I - Processed: ' . $items_processed . " - " . date("H:i:s") . "</span><br>", "FULL_FEEDBACK");
}
}
print_msg("<br><span class='processed'>Going to process another {$step_amt} items</span>", "FULL_FEEDBACK");
}
print_msg("Finished Part I -" . date("H:i:s"));
//---------------------------------------------------------------------------
// now loop through again and do the versions... this is highly inefficient
// to loop through the dataset another time but it works without big changes
//---------------------------------------------------------------------------
print_msg("<br> <b><center>Migrating Test Cases - Part II - " . date("H:i:s") . " -</center></b><br>");
$items_processed = 0;
while ($items_processed < $tc_count) {
$query = "SELECT * FROM {$tmp_table_name} ORDER BY id LIMIT {$items_processed},{$step_amt}";
$items = $source_db->fetchRowsIntoMap($query, 'id');
foreach ($items as $item_id => $idata) {
// Now create the TC version
$author_id = intval(isset($users[$idata['author']]) ? $users[$idata['author']]['id'] : $admin_id);
$x = $tc_mgr->create_tcversion($item_id, $first_version, $idata['summary'], $idata['steps'], $idata['exresult'], $author_id);
$sql = "UPDATE tcversions SET creation_ts='" . $idata['create_date'] . "'";
// update reviewer & review date
$reviewer_id = intval(isset($users[$idata['reviewer']]) ? $users[$idata['reviewer']]['id'] : -1);
if ($reviewer_id > 0) {
$sql .= ",updater_id={$reviewer_id}" . ",modification_ts='" . $idata['modified_date'] . "'";
}
// 20070119 - franciscom - very big bug - missing where clause
$sql .= " WHERE tcversions.id={$x['id']} ";
//echo "<br>update query is $sql";
$target_db->exec_query($sql);
$map_tc_tcversion[$item_id] = $x['id'];
// 20061208 - franciscom
print_msg("TCID:{$item_id} - " . htmlentities($idata['title']) . " - TCVERSION_ID:{$x['id']}<br>", "FULL_FEEDBACK");
++$items_processed;
if ($items_processed % FEEDBACK_STEP == 0) {
print_msg('<br><span class="processed">Part II - Processed: ' . $items_processed . " - " . date("H:i:s") . "</span><br><br>");
}
}
print_msg("<br><span class='processed'>Going to process another {$step_amt} items</span>", "FULL_FEEDBACK");
}
print_msg("Test Case Specifications MIGRATION ENDED ::: " . date("H:i:s") . "<br>");
return $map_tc_tcversion;
}