function it_searches_issues(Client $client) { $jql = 'project = example'; $json = array('issues' => array($this->getTestResponse())); $client->get('/search', array('jql' => urlencode($jql)))->shouldBeCalled()->willReturn($json); $this->searchIssues($jql)->shouldHaveCount(1); }
/** * Searches by jql query provided * * @param string $jql More info about jql: https://confluence.atlassian.com/display/JIRA/Advanced+Searching * @return array Issue */ public function searchIssues($jql) { $response = $this->client->get('/search', array('jql' => urlencode($jql))); $issues = array(); foreach ($response['issues'] as $jsonIssue) { $issues[] = new Issue($jsonIssue); } return $issues; }