Skip to content

Commit 15dcea2

Browse files
bobeaganacrobat
authored andcommitted
Issue body optional (KnpLabs#625)
* remove body from being required when creating an issue * update test
1 parent 22319ee commit 15dcea2

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" betwee
88

99
- Support for graphql api [variables](https://developer.github.com/v4/guides/forming-calls/#working-with-variables) (#612)
1010
- Added missing branch protection methods (#616)
11+
- Remove `body` as a required parameter when creating an issue (#624)
1112

1213
## 2.5.0
1314

lib/Github/Api/Issue.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ public function show($username, $repository, $id)
129129
*/
130130
public function create($username, $repository, array $params)
131131
{
132-
if (!isset($params['title'], $params['body'])) {
133-
throw new MissingArgumentException(array('title', 'body'));
132+
if (!isset($params['title'])) {
133+
throw new MissingArgumentException(array('title'));
134134
}
135135

136136
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues', $params);

test/Github/Tests/Api/IssueTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,17 @@ public function shouldNotCreateIssueWithoutTitle()
105105

106106
/**
107107
* @test
108-
* @expectedException \Github\Exception\MissingArgumentException
109108
*/
110-
public function shouldNotCreateIssueWithoutBody()
109+
public function shouldCreateIssueWithoutBody()
111110
{
112111
$data = array(
113112
'title' => 'some title'
114113
);
115114

116115
$api = $this->getApiMock();
117-
$api->expects($this->never())
118-
->method('post');
116+
$api->expects($this->once())
117+
->method('post')
118+
->with('/repos/ornicar/php-github-api/issues', $data);
119119

120120
$api->create('ornicar', 'php-github-api', $data);
121121
}

0 commit comments

Comments
 (0)