Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .git-pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ for file in $FILES; do
./vendor/bin/phpcs --extensions=php --standard=PSR12 "$file"
./vendor/bin/phpmd "$file" text phpmd.xml
done
XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-text --coverage-filter=src/ tests/
XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-text --coverage-filter=src/ tests/Unit/
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
run: ./vendor/bin/phpmd . text phpmd.xml --exclude vendor

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

- name: codecov
uses: codecov/codecov-action@v2
10 changes: 10 additions & 0 deletions src/Issue.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,14 @@ public function create(array $data)
$response = $this->core->request('CreateIssue', $data);
return $response['Issue'];
}

public function delete(array $data)
{
$this->validate($data, [
'ProjectName' => 'string|required',
'IssueCode' => 'integer|required',
]);
$this->core->request('DeleteIssue', $data);
return true;
}
}
19 changes: 19 additions & 0 deletions tests/Unit/IssueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,23 @@ public function testCreateSuccessWithAllParams()
$result = $issue->create($data);
$this->assertEquals($response['Issue'], $result);
}

public function testDelete()
{
$response = json_decode(
file_get_contents($this->dataPath('DeleteIssueResponse.json')),
true
)['Response'];
$data = [
'ProjectName' => $this->projectName,
'IssueCode' => $this->faker->randomNumber(),
];
$this->coreMock->shouldReceive('request')->times(1)->withArgs([
'DeleteIssue',
$data
])->andReturn($response);

$issue = new Issue($this->token, $this->coreMock);
$this->assertTrue($issue->delete($data));
}
}
5 changes: 5 additions & 0 deletions tests/data/DeleteIssueResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"Response": {
"RequestId": "135f80f0-0577-6421-293e-ec231ff3b337"
}
}