/** * 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_puts_issues(Client $client, Issue $issue) { $issue->getKey()->shouldBeCalled()->willReturn('XXX-42'); $issue->toJSON()->shouldBeCalled()->willReturn('{}'); $client->put("/issue/XXX-42", '{}')->shouldBeCalled()->willReturn(array('id' => 'XXX-42')); $json = $this->getTestResponse(); $client->get('/issue/XXX-42', array())->shouldBeCalled()->willReturn($json); $this->putIssue($issue); }