Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e1cad88

Browse files
feat: #34 delete iteration
1 parent 887f44c commit e1cad88

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

‎src/Iteration.php

Lines changed: 10 additions & 0 deletions
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

Lines changed: 19 additions & 0 deletions
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
}

‎tests/data/DeleteIterationResponse.json

Lines changed: 5 additions & 0 deletions
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)

AltStyle によって変換されたページ (->オリジナル) /