app/Http/Controllers/Handlers/CloneHandler.php
/*
		Clone all test steps and executions for given FROM testcase id to TO testcase id
	*/
Clone all test steps and executions for given FROM testcase id to TO testcase id
Clone all test steps and executions for given FROM testcase id to TO testcase id
public function cloneAllSteps($from_tc_id, $to_tc_id)
	{
		$steps = \App\TestStep::where('tc_id' , $from_tc_id)->get()->toArray();
		foreach ($steps as $value) {
	        $old_ts_id = $value['ts_id'] ;
			$value['ts_id'] = $to_tc_id."_".$this->genrateRandomInt();
			$value['tc_id'] = $to_tc_id;
			$value['tp_id'] = session()->get('open_project');
			$value['status']= 'not_executed';
			$value['created_by']	= session()->get('email');
			\App\TestStep::create($value);
			$exe 			= \App\Execution::where(['ts_id' => $old_ts_id, 'tl_id' => 0 ])->get()->toArray();
			$exe[0]['e_id'] 	= $value['ts_id']."_".$this->genrateRandomInt(8);
			$exe[0]['ts_id'] 	= $value['ts_id'] ;
			$exe[0]['tp_id'] 	= session()->get('open_project');
			$exe[0]['tc_id'] 	= $value['tc_id'] ;
			\App\Execution::create($exe[0]);
		}
		return;
	}
public function cloneAllSteps ( $ from_tc_id , $ to_tc_id ) { $ steps = \ App \ TestStep :: where ( 'tc_id' , $ from_tc_id ) -> get ( ) -> toArray ( ) ; foreach ( $ steps as $ value ) { $ old_ts_id = $ value [ 'ts_id' ] ; $ value [ 'ts_id' ] = $ to_tc_id . " _ " . $ this -> genrateRandomInt ( ) ; $ value [ 'tc_id' ] = $ to_tc_id ; $ value [ 'tp_id' ] = session ( ) -> get ( 'open_project' ) ; $ value [ 'status' ] = 'not_executed' ; $ value [ 'created_by' ] = session ( ) -> get ( 'email' ) ; \ App \ TestStep :: create ( $ value ) ; $ exe = \ App \ Execution :: where ( [ 'ts_id' => $ old_ts_id , 'tl_id' => 0 ] ) -> get ( ) -> toArray ( ) ; $ exe [ 0 ] [ 'e_id' ] = $ value [ 'ts_id' ] . " _ " . $ this -> genrateRandomInt ( 8 ) ; $ exe [ 0 ] [ 'ts_id' ] = $ value [ 'ts_id' ] ; $ exe [ 0 ] [ 'tp_id' ] = session ( ) -> get ( 'open_project' ) ; $ exe [ 0 ] [ 'tc_id' ] = $ value [ 'tc_id' ] ; \ App \ Execution :: create ( $ exe [ 0 ] ) ; } return ; }
Clone all test steps and executions for given FROM testcase id to TO testcase id
Clone all test steps and executions for given FROM testcase id to TO testcase id
//clone all steps for this testcase //Add entry in execution table for this step