Example #1
0
 /**
  * Delete a Test suite, deleting:
  * - Children Test Cases
  * - Test Suite Attachments
  * - Test Suite Custom fields 
  * - Test Suite Keywords
  *
  * IMPORTANT/CRITIC: 
  * this can used to delete a Test Suite that contains ONLY Test Cases.
  *
  * This function is needed by tree class method: delete_subtree_objects()
  *
  * To delete a Test Suite that contains other Test Suites delete_deep() 
  * must be used.
  *
  * ATTENTION: may be in future this can be refactored, and written better. 
  *
  */
 function delete($id)
 {
     $tcase_mgr = new testcase($this->db);
     $tsuite_info = $this->get_by_id($id);
     $testcases = $this->get_children_testcases($id);
     if (!is_null($testcases)) {
         foreach ($testcases as $the_key => $elem) {
             $tcase_mgr->delete($elem['id']);
         }
     }
     // What about keywords ???
     $this->cfield_mgr->remove_all_design_values_from_node($id);
     $this->deleteAttachments($id);
     //inherited
     $this->deleteKeywords($id);
     $sql = "DELETE FROM {$this->object_table} WHERE id={$id}";
     $result = $this->db->exec_query($sql);
     $sql = "DELETE FROM {$this->tables['nodes_hierarchy']} WHERE id={$id}";
     $result = $this->db->exec_query($sql);
 }