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 e19b724

Browse files
feat: #16 delete issue
1 parent 5afee4e commit e19b724

File tree

5 files changed

+36
-2
lines changed

5 files changed

+36
-2
lines changed

‎.git-pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ for file in $FILES; do
66
./vendor/bin/phpcs --extensions=php --standard=PSR12 "$file"
77
./vendor/bin/phpmd "$file" text phpmd.xml
88
done
9-
XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-text --coverage-filter=src/ tests/
9+
XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-text --coverage-filter=src/ tests/Unit/

‎.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
run: ./vendor/bin/phpmd . text phpmd.xml --exclude vendor
3434

3535
- name: Test
36-
run: XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-clover coverage.xml --coverage-filter src/ tests/
36+
run: XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-clover coverage.xml --coverage-filter src/ tests/Unit
3737

3838
- name: codecov
3939
uses: codecov/codecov-action@v2

‎src/Issue.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,14 @@ public function create(array $data)
6161
$response = $this->core->request('CreateIssue', $data);
6262
return $response['Issue'];
6363
}
64+
65+
public function delete(array $data)
66+
{
67+
$this->validate($data, [
68+
'ProjectName' => 'string|required',
69+
'IssueCode' => 'integer|required',
70+
]);
71+
$this->core->request('DeleteIssue', $data);
72+
return true;
73+
}
6474
}

‎tests/Unit/IssueTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,23 @@ public function testCreateSuccessWithAllParams()
9090
$result = $issue->create($data);
9191
$this->assertEquals($response['Issue'], $result);
9292
}
93+
94+
public function testDelete()
95+
{
96+
$response = json_decode(
97+
file_get_contents($this->dataPath('DeleteIssueResponse.json')),
98+
true
99+
)['Response'];
100+
$data = [
101+
'ProjectName' => $this->projectName,
102+
'IssueCode' => $this->faker->randomNumber(),
103+
];
104+
$this->coreMock->shouldReceive('request')->times(1)->withArgs([
105+
'DeleteIssue',
106+
$data
107+
])->andReturn($response);
108+
109+
$issue = new Issue($this->token, $this->coreMock);
110+
$this->assertTrue($issue->delete($data));
111+
}
93112
}

‎tests/data/DeleteIssueResponse.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"Response": {
3+
"RequestId": "135f80f0-0577-6421-293e-ec231ff3b337"
4+
}
5+
}

0 commit comments

Comments
(0)

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