Skip to content

Commit 72530c2

Browse files
committed
test: #33 update issue status
1 parent 833612c commit 72530c2

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

tests/Acceptance/IssueTest.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Coding\Core;
66
use Coding\Issue;
7+
use Coding\ProjectSetting;
78

89
class IssueTest extends TestCase
910
{
@@ -17,6 +18,7 @@ public function testCrud()
1718
];
1819

1920
$issue = new Issue($this->token);
21+
$projectSetting = new ProjectSetting($this->token);
2022
$result = $issue->create($data);
2123
$this->assertTrue(is_numeric($result['Code']));
2224

@@ -28,9 +30,19 @@ public function testCrud()
2830
$this->assertEquals($data['Name'], $result['Name']);
2931
$this->assertEmpty($result['StoryPoint']);
3032

31-
$params['StoryPoint'] = '1.0';
32-
$result = $issue->update($params);
33-
$this->assertEquals('1.0', $result['StoryPoint']);
33+
$statuses = $projectSetting->getIssueStatuses([
34+
'ProjectName' => $this->projectName,
35+
'IssueTypeId' => $result['IssueTypeId'],
36+
]);
37+
38+
$storyPoint = '1.0';
39+
$statusId = end($statuses)['IssueStatusId'];
40+
$result = $issue->update(array_merge($params, [
41+
'StoryPoint' => $storyPoint,
42+
'StatusId' => $statusId,
43+
]));
44+
$this->assertEquals($storyPoint, $result['StoryPoint']);
45+
$this->assertEquals($statusId, $result['IssueStatusId']);
3446

3547
$this->assertTrue($issue->delete($params));
3648
}

0 commit comments

Comments
 (0)