/**
  * Updates an existing issue and returns a complete Issue object
  *
  * @param Issue $issue
  *
  * @throws BadRequestException when invalid issue key given
  * @return Issue
  */
 public function putIssue(Issue $issue)
 {
     if (!$issue->getKey()) {
         throw new BadRequestException('Invalid issue key');
     }
     $this->client->put("/issue/" . $issue->getKey(), $issue->toJSON());
     return $this->getIssue($issue->getKey());
 }
 function it_throws_exception_if_key_null(Issue $issue)
 {
     $issue->getKey()->shouldBeCalled()->willReturn(null);
     $this->shouldThrow('GorkaLaucirica\\JiraApiClient\\Exception\\BadRequestException')->during('putIssue', array($issue));
 }