/** * {@inheritdoc} */ public function getProject($name) { $project = $this->client->getProject($name); if (!is_array($project) || !isset($project['key'])) { throw new NotFoundException(sprintf('unable to find "%s"', $name)); } return new JiraProject($project, $this->client, $this->badgeFactory); }
public function it_returns_a_list_of_products_on_findProjects(Api $client) { $client->getProject('FOOBAR')->willReturn(['key' => 'FOOBAR', 'name' => 'FOOBAR']); $projects = $this->findProjects('FOOBAR'); $projects->shouldBeArray(); $projects['FOOBAR']->shouldHaveType('Rs\\Issues\\Project'); $projects['FOOBAR']->shouldHaveType('Rs\\Issues\\Jira\\JiraProject'); }
public function it_returns_its_issues(Api $client, Result $result, Issue $issue) { $result->getIssues()->shouldBeCalled()->willReturn([$issue]); $result->getTotal()->shouldBeCalled()->willReturn(1); $result->getIssuesCount()->shouldBeCalled()->willReturn(1); $client->search('project = FOOBAR AND status != closed AND status != resolved', 0, 50, null)->shouldBeCalled()->willReturn($result); $result = $this->getIssues(); $result->shouldBeArray(); $result->shouldHaveCount(1); $result[0]->shouldHaveType('Rs\\Issues\\Jira\\JiraIssue'); }
<?php require dirname(__FILE__) . "/common.php"; $api = new Jira_Api("https://your-jira-project.net", new Jira_Api_Authentication_Basic("yourname", "password")); /** * available options. * "description" => string * "userReleaseDate" => YYYY-MM-DD * "releaseDate" => YYYY-MM-DD * "released" => boolean * "archived" => boolean * * this api will throw an Exceptions when passed invalid options, or already created. */ $api->createVersion("YOURPRJOECT", "0.3.1", $options = array());
<?php require dirname(__FILE__) . "/common.php"; $api = new Jira_Api("https://your-jira-project.net", new Jira_Api_Authentication_Basic("yourname", "password")); $api->editIssue($key, array("fields" => array("<FieldID>" => "Value")));
} } print " + Selected attachment as body: {$tkBodyKey} ({$tkBodySize})\n"; if ($tkBodyKey === -1) { print " + ERROR: Can't fetch issue content\n"; die(1); } $response = $rt->getAttachmentContent($RT_ID, $tkBodyKey); //print "BODY:\n$response\n"; $tkBody = $response; /* * ***************************** JIRA PART ****************************** */ print "Publishing to JIRA as: " . JIRA_USER . "\n"; try { $jira2 = new Jira_Api(JIRA_URL, new Jira_Api_Authentication_Basic(JIRA_USER, JIRA_PASSWORD)); $tkBody = "{code}\n" . $tkBody . "\n{code}"; $options = array('description' => $tkBody); $tkLabel = 'RT #' . $RT_ID . ' - ' . $tkDetails['Subject']; $result = $jira2->createIssue($JIRA_KEY, $tkLabel, JIRA_TICKET_TYPE, $options); $issueDetails = $result->getResult(); if (!isset($issueDetails['key'])) { print " + ERROR: Failed to acquire new issue key.\n"; die(2); } $issueKey = $issueDetails['key']; print " + Created JIRA Issue: " . $issueKey . "\n"; $issueUrl = JIRA_URL . "/browse/{$issueKey}"; print " + URL: {$issueUrl}\n"; $result = $jira2->addRemoteLinks($issueKey, $tkUrl, $tkLabel); $linkDetails = $result->getResult();