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 338397a

Browse files
feat: #34 update iteration
1 parent e1cad88 commit 338397a

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

‎src/Iteration.php‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,21 @@ public function get(array $data)
2828
return $response['Iteration'];
2929
}
3030

31+
public function update(array $data)
32+
{
33+
$this->validate($data, [
34+
'ProjectName' => 'string|required',
35+
'IterationCode' => 'integer|required',
36+
'Name' => 'nullable|string',
37+
'Goal' => 'nullable|string',
38+
'Assignee' => 'nullable|integer',
39+
'StartAt' => 'nullable|date_format:Y-m-d',
40+
'EndAt' => 'nullable|date_format:Y-m-d|after:StartAt',
41+
]);
42+
$response = $this->core->request('ModifyIteration', $data);
43+
return $response['Iteration'];
44+
}
45+
3146
public function delete(array $data)
3247
{
3348
$this->validate($data, [

‎tests/Unit/IterationTest.php‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,28 @@ public function testGet()
123123
$this->assertEquals($response['Iteration'], $result);
124124
}
125125

126+
public function testUpdate()
127+
{
128+
$response = json_decode(
129+
file_get_contents($this->dataPath('ModifyIterationResponse.json')),
130+
true
131+
)['Response'];
132+
$data = [
133+
'ProjectName' => $this->projectName,
134+
'IterationCode' => $this->faker->randomNumber(),
135+
'Goal' => $this->faker->sentence,
136+
];
137+
$this->coreMock->shouldReceive('request')->times(1)->withArgs([
138+
'ModifyIteration',
139+
$data
140+
])->andReturn($response);
141+
142+
$iteration = new Iteration('', $this->coreMock);
143+
$iteration->setToken($this->token);
144+
$result = $iteration->update($data);
145+
$this->assertEquals($response['Iteration'], $result);
146+
}
147+
126148
public function testDelete()
127149
{
128150
$response = json_decode(
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"Response" : {
3+
"Iteration" : {
4+
"Assignee" : 0,
5+
"Code" : 20,
6+
"CompletedCount" : 0,
7+
"CompletedPercent" : 0,
8+
"Completer" : 0,
9+
"CreatedAt" : 1640921166000,
10+
"Creator" : 183478,
11+
"Deleter" : 0,
12+
"EndAt" : -28800000,
13+
"Goal" : "foo",
14+
"Name" : "sprint 666",
15+
"ProcessingCount" : 0,
16+
"StartAt" : -28800000,
17+
"Starter" : 0,
18+
"Status" : "WAIT_PROCESS",
19+
"UpdatedAt" : 1640921166000,
20+
"WaitProcessCount" : 0
21+
},
22+
"RequestId" : "0761cb2d-601c-1db3-f796-73b03d28fe85"
23+
}
24+
}

0 commit comments

Comments
(0)

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