Skip to content

Commit 887f44c

Browse files
committed
feat: #34 get iteration
1 parent 72530c2 commit 887f44c

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

src/Iteration.php

+10
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,14 @@ public function create(array $data)
1717
$response = $this->core->request('CreateIteration', $data);
1818
return $response['Iteration'];
1919
}
20+
21+
public function get(array $data)
22+
{
23+
$this->validate($data, [
24+
'ProjectName' => 'string|required',
25+
'IterationCode' => 'integer|required',
26+
]);
27+
$response = $this->core->request('DescribeIteration', $data);
28+
return $response['Iteration'];
29+
}
2030
}

tests/Unit/IterationTest.php

+20
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,24 @@ public function testCreateFailedBefore()
102102
$this->expectExceptionMessage('The end at must be a date after start at.');
103103
$iteration->create($data);
104104
}
105+
106+
public function testGet()
107+
{
108+
$response = json_decode(
109+
file_get_contents($this->dataPath('DescribeIterationResponse.json')),
110+
true
111+
)['Response'];
112+
$data = [
113+
'ProjectName' => $this->projectName,
114+
'IterationCode' => $this->faker->randomNumber(),
115+
];
116+
$this->coreMock->shouldReceive('request')->times(1)->withArgs([
117+
'DescribeIteration',
118+
$data
119+
])->andReturn($response);
120+
121+
$iteration = new Iteration($this->token, $this->coreMock);
122+
$result = $iteration->get($data);
123+
$this->assertEquals($response['Iteration'], $result);
124+
}
105125
}
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"Response" : {
3+
"Iteration" : {
4+
"Assignee" : 0,
5+
"Code" : 10,
6+
"CompletedCount" : 0,
7+
"CompletedPercent" : 0,
8+
"Completer" : 0,
9+
"CreatedAt" : 1640672501000,
10+
"Creator" : 183478,
11+
"Deleter" : 0,
12+
"EndAt" : -28800000,
13+
"Goal" : "",
14+
"Name" : "sprint 1",
15+
"ProcessingCount" : 0,
16+
"StartAt" : -28800000,
17+
"Starter" : 0,
18+
"Status" : "WAIT_PROCESS",
19+
"UpdatedAt" : 1640672501000,
20+
"WaitProcessCount" : 0
21+
},
22+
"RequestId" : "78bb5b45-acc9-7ccc-edfc-a802f473b169"
23+
}
24+
}

0 commit comments

Comments
 (0)