1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Integrations\Connectors\SenhorVerdugo; |
4
|
|
|
|
5
|
|
|
use Log; |
6
|
|
|
use App\Models\Project as ProjectModel; |
7
|
|
|
use SenhorVerdugoRestApi\Project\ProjectService; |
8
|
|
|
use SenhorVerdugoRestApi\SenhorVerdugoException; |
9
|
|
|
|
10
|
|
|
class Delete extends SenhorVerdugo |
11
|
|
|
{ |
12
|
|
View Code Duplication |
public function watchFromIssue() |
|
|
|
|
13
|
|
|
{ |
14
|
|
|
$issueKey = 'TEST-961'; |
15
|
|
|
|
16
|
|
|
try { |
17
|
|
|
$issueService = new IssueService(); |
18
|
|
|
|
19
|
|
|
// watcher's id |
20
|
|
|
$watcher = 'lesstif'; |
21
|
|
|
|
22
|
|
|
$issueService->removeWatcher($issueKey, $watcher); |
23
|
|
|
|
24
|
|
|
} catch (SenhorVerdugoException $e) { |
|
|
|
|
25
|
|
|
$this->assertTrue(false, 'add watcher Failed : '.$e->getMessage()); |
26
|
|
|
} |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
public function comment() |
30
|
|
|
{ |
31
|
|
|
$issueKey = "TEST-879"; |
32
|
|
|
|
33
|
|
|
try { |
34
|
|
|
$commentId = 12345; |
35
|
|
|
|
36
|
|
|
$issueService = new IssueService(); |
37
|
|
|
|
38
|
|
|
$ret = $issueService->deleteComment($issueKey, $commentId); |
|
|
|
|
39
|
|
|
|
40
|
|
|
} catch (SenhorVerdugoException $e) { |
|
|
|
|
41
|
|
|
$this->assertTrue(false, 'Delete comment Failed : '.$e->getMessage()); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
} |
45
|
|
|
|
46
|
|
View Code Duplication |
public function issue() |
|
|
|
|
47
|
|
|
{ |
48
|
|
|
|
49
|
|
|
$issueKey = "TEST-879"; |
50
|
|
|
|
51
|
|
|
try { |
52
|
|
|
$issueService = new IssueService(); |
53
|
|
|
|
54
|
|
|
$ret = $issueService->deleteIssue($issueKey); |
55
|
|
|
// if you want to delete issues with sub-tasks |
56
|
|
|
//$ret = $issueService->deleteIssue($issueKey, array('deleteSubtasks' => 'true')); |
57
|
|
|
|
58
|
|
|
var_dump($ret); |
|
|
|
|
59
|
|
|
} catch (SenhorVerdugoException $e) { |
|
|
|
|
60
|
|
|
$this->assertTrue(false, "Change Assignee Failed : " . $e->getMessage()); |
61
|
|
|
} |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function project(ProjectModel $project) |
65
|
|
|
{ |
66
|
|
|
try { |
67
|
|
|
$proj = new ProjectService(); |
68
|
|
|
|
69
|
|
|
$pj = $proj->deleteProject('EX'); |
70
|
|
|
|
71
|
|
|
var_dump($pj); |
|
|
|
|
72
|
|
|
} catch (SenhorVerdugoException $e) { |
|
|
|
|
73
|
|
|
print("Error Occured! " . $e->getMessage()); |
74
|
|
|
} |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.