function it_posts_issues(Client $client, Issue $issue) { $issue->toJSON()->shouldBeCalled()->willReturn('{}'); $client->post("/issue", '{}')->shouldBeCalled()->willReturn(array('id' => 'XXX-42')); $response = $this->getTestResponse(); $client->get('/issue/XXX-42', array())->shouldBeCalled()->willReturn($response); $this->postIssue($issue); }
/** * Posts a new issue and returns a complete Issue object * * @param Issue $issue * @return Issue */ public function postIssue(Issue $issue) { $response = $this->client->post("/issue", $issue->toJSON()); return $this->getIssue($response['id']); }