Skip to content

Commit 02b5e94

Browse files
committed
feat: #34 delete iteration
1 parent 88abfc6 commit 02b5e94

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

src/Iteration.php

+10
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,14 @@ public function get(array $data)
2727
$response = $this->core->request('DescribeIteration', $data);
2828
return $response['Iteration'];
2929
}
30+
31+
public function delete(array $data)
32+
{
33+
$this->validate($data, [
34+
'ProjectName' => 'string|required',
35+
'IterationCode' => 'integer|required',
36+
]);
37+
$this->core->request('DeleteIteration', $data);
38+
return true;
39+
}
3040
}

tests/Unit/IterationTest.php

+19
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,23 @@ public function testGet()
122122
$result = $iteration->get($data);
123123
$this->assertEquals($response['Iteration'], $result);
124124
}
125+
126+
public function testDelete()
127+
{
128+
$response = json_decode(
129+
file_get_contents($this->dataPath('DeleteIterationResponse.json')),
130+
true
131+
)['Response'];
132+
$data = [
133+
'ProjectName' => $this->projectName,
134+
'IterationCode' => $this->faker->randomNumber(),
135+
];
136+
$this->coreMock->shouldReceive('request')->times(1)->withArgs([
137+
'DeleteIteration',
138+
$data
139+
])->andReturn($response);
140+
141+
$issue = new Iteration($this->token, $this->coreMock);
142+
$this->assertTrue($issue->delete($data));
143+
}
125144
}
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"Response" : {
3+
"RequestId" : "84cb9b6c-aa70-083a-e87e-436145ec4259"
4+
}
5+
}

0 commit comments

Comments
 (0)