Created
April 29, 2020 08:52
-
-
Save lesstif/4bbe3e40089dbc06e923812051ecada5 to your computer and use it in GitHub Desktop.
get all jira issue's attachments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use JiraRestApi\Attachment\AttachmentService; | |
use JiraRestApi\JiraException; | |
class GetAllJiraAttachmentTest extends PHPUnit_Framework_TestCase | |
{ | |
public function testGetIssue() | |
{ | |
$key = 'TEST-484'; | |
try { | |
$iss = new \JiraRestApi\Issue\IssueService(); | |
$issue = $iss->get($key); | |
// print all attachments | |
dump($issue->fields->attachment); | |
return $issue->fields->attachment; | |
} catch (JiraException $e) { | |
$this->assertTrue(false, 'Create Failed : '.$e->getMessage()); | |
} | |
} | |
/** | |
* @depends testGetIssue | |
* | |
* @param string $key | |
* @return int | |
* @throws JsonMapper_Exception | |
*/ | |
public function testGetAttachment(array $attachments) | |
{ | |
try { | |
foreach ($attachments as $attachment) { | |
$atts = new AttachmentService(); | |
$att = $atts->get($attachment->id, "output", true); | |
dump($att); | |
} | |
} catch (JiraException $e) { | |
$this->assertTrue(false, 'Create Failed : '.$e->getMessage()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment