From 9c5e284aa02f0a8efd71c0e6e76914b054e420e0 Mon Sep 17 00:00:00 2001 From: Bob Eagan Date: Wed, 23 Aug 2017 14:08:44 -0700 Subject: [PATCH 1/2] remove body from being required when creating an issue --- CHANGELOG.md | 1 + lib/Github/Api/Issue.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) 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); From 28fa409ee5eddc768acc6ac0dc9042b53c591807 Mon Sep 17 00:00:00 2001 From: Bob Eagan Date: Wed, 23 Aug 2017 14:11:18 -0700 Subject: [PATCH 2/2] update test --- test/Github/Tests/Api/IssueTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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); }