diff --git a/CHANGELOG.md b/CHANGELOG.md index fc9bad6dc3f..f77faa1a6bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" betwee - Support for graphql api [variables](https://developer.github.com/v4/guides/forming-calls/#working-with-variables) (#612) - Added missing branch protection methods (#616) +- Remove `body` as a required parameter when creating an issue (#624) ## 2.5.0 diff --git a/lib/Github/Api/Issue.php b/lib/Github/Api/Issue.php index fa79ffa63cc..1ec7e79e89c 100644 --- a/lib/Github/Api/Issue.php +++ b/lib/Github/Api/Issue.php @@ -129,8 +129,8 @@ public function show($username, $repository, $id) */ public function create($username, $repository, array $params) { - if (!isset($params['title'], $params['body'])) { - throw new MissingArgumentException(array('title', 'body')); + if (!isset($params['title'])) { + throw new MissingArgumentException(array('title')); } return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/issues', $params); diff --git a/test/Github/Tests/Api/IssueTest.php b/test/Github/Tests/Api/IssueTest.php index a8a40835b39..5596f6be4de 100644 --- a/test/Github/Tests/Api/IssueTest.php +++ b/test/Github/Tests/Api/IssueTest.php @@ -105,17 +105,17 @@ public function shouldNotCreateIssueWithoutTitle() /** * @test - * @expectedException \Github\Exception\MissingArgumentException */ - public function shouldNotCreateIssueWithoutBody() + public function shouldCreateIssueWithoutBody() { $data = array( 'title' => 'some title' ); $api = $this->getApiMock(); - $api->expects($this->never()) - ->method('post'); + $api->expects($this->once()) + ->method('post') + ->with('/repos/ornicar/php-github-api/issues', $data); $api->create('ornicar', 'php-github-api', $data); }