Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
lesstif committed Aug 25, 2015
2 parents c331c87 + f390e2b commit 3d12407
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 20 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ try {
$issueService = new IssueService();

// get issue's time tracking info
$ret = $issueService->getWorklog($this->issueKey);
$ret = $issueService->getTimeTracking($this->issueKey);
var_dump($ret);

$timeTracking = new TimeTracking;
Expand All @@ -320,7 +320,7 @@ try {
$timeTracking->setRemainingEstimate('1w 2d 3h');

// add time tracking
$ret = $issueService->worklog($this->issueKey, $timeTracking);
$ret = $issueService->timeTracking($this->issueKey, $timeTracking);
var_dump($ret);
} catch (JIRAException $e) {
$this->assertTrue(false, 'testSearch Failed : '.$e->getMessage());
Expand Down
2 changes: 1 addition & 1 deletion src/Issue/IssueField.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function getIssueType()
public $progress;

/** @var TimeTracking */
public $timetracking;
public $timeTracking;

/** @var IssueType */
public $issuetype;
Expand Down
24 changes: 10 additions & 14 deletions src/Issue/IssueService.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,32 +223,32 @@ public function search($jql, $startAt=0, $maxResults=15, $fields=[])
}

/**
* get worklog info
* get TimeTracking info
*
* @param type $issueIdOrKey
* @return type @TimeTracking
*/
public function getWorklog($issueIdOrKey)
public function getTimeTracking($issueIdOrKey)
{
$ret = $this->exec($this->uri . "/$issueIdOrKey", null);
$this->log->addDebug("getWorklog res=$ret\n");
$this->log->addDebug("getTimeTracking res=$ret\n");

$issue = $this->json_mapper->map(
json_decode($ret), new Issue()
);

return $issue->fields->timetracking;
return $issue->fields->timeTracking;
}

/**
* worklog issues
* TimeTracking issues
*
* @param issueIdOrKey Issue id or key
* @param timeTracking TimeTracking
*
* @return TimeTracking
* @return type @TimeTracking
*/
public function worklog($issueIdOrKey, $timeTracking)
public function timeTracking($issueIdOrKey, $timeTracking)
{
$array = ["update" =>
[
Expand All @@ -260,16 +260,12 @@ public function worklog($issueIdOrKey, $timeTracking)

$data = json_encode($array);

$this->log->addDebug("worklog req=$data\n");
$this->log->addDebug("TimeTracking req=$data\n");

// if success, just return HTTP 201.
$ret = $this->exec($this->uri . "/$issueIdOrKey", $data, 'PUT');

// FIXME
$result = $this->json_mapper->map(
json_decode($ret), new TimeTracking()
);

return $result;
return $ret;
}
}

Expand Down
6 changes: 3 additions & 3 deletions tests/TimeTrackingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

class TimeTrackingTest extends PHPUnit_Framework_TestCase
{
private $issueKey = 'TEST-961';
private $issueKey = 'TEST-76';

public function testGetTimeTracking()
{
try {
$issueService = new IssueService();

$ret = $issueService->getWorklog($this->issueKey);
$ret = $issueService->getTimeTracking($this->issueKey);
var_dump($ret);
} catch (JIRAException $e) {
$this->assertTrue(false, 'testGetTimeTracking Failed : '.$e->getMessage());
Expand All @@ -31,7 +31,7 @@ public function testPostTimeTracking()
try {
$issueService = new IssueService();

$ret = $issueService->worklog($this->issueKey, $timeTracking);
$ret = $issueService->timeTracking($this->issueKey, $timeTracking);
var_dump($ret);
} catch (JIRAException $e) {
$this->assertTrue(false, 'testPostTimeTracking Failed : '.$e->getMessage());
Expand Down

0 comments on commit 3d12407

Please sign in to comment.