-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
revised SprintService - add sample file(ref #496)
- Loading branch information
Showing
1 changed file
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,89 @@ | ||
<?php | ||
namespace JiraRestApi\Test; | ||
|
||
use DateInterval; | ||
use DateTime; | ||
use Exception; | ||
use JiraRestApi\JiraException; | ||
use JiraRestApi\Sprint\Sprint; | ||
use JiraRestApi\Sprint\SprintService; | ||
use PHPUnit\Framework\TestCase; | ||
use JiraRestApi\Dumper; | ||
use JiraRestApi\Issue\Reporter; | ||
|
||
class SPrintTest extends TestCase | ||
{ | ||
/** | ||
* @test | ||
* | ||
*/ | ||
public function create_sprint() : int | ||
{ | ||
$start = (new DateTime('NOW'))->add(DateInterval::createFromDateString('1 month 5 day')); | ||
|
||
$sp = (new Sprint()) | ||
->setNameAsString("My Sprint 1") | ||
->setGoalAsString("goal") | ||
->setOriginBoardIdAsStringOrInt(3) | ||
->setStartDateAsDateTime($start) | ||
->setEndDateAsDateTime($start->add(DateInterval::createFromDateString('3 week'))) | ||
; | ||
|
||
try { | ||
$sps = new SprintService(); | ||
|
||
$sprint = $sps->createSprint($sp); | ||
|
||
$this->assertNotNull($sprint->name); | ||
|
||
return $sprint->id; | ||
|
||
} catch (Exception $e) { | ||
$this->fail('testSearch Failed : '.$e->getMessage()); | ||
} | ||
} | ||
|
||
/** | ||
* @test | ||
* | ||
* @depends create_sprint | ||
* | ||
* @throws \JsonMapper_Exception | ||
*/ | ||
public function get_sprints(int $sprintId) : int | ||
{ | ||
try { | ||
$sps = new SprintService(); | ||
|
||
$sprint = $sps->getSprint($sprintId); | ||
|
||
$this->assertNotNull($sprint->name); | ||
Dumper::dump($sprint); | ||
|
||
return $sprintId; | ||
} catch (Exception $e) { | ||
$this->fail('testSearch Failed : '.$e->getMessage()); | ||
} | ||
} | ||
|
||
/** | ||
* @test | ||
* @depends get_sprints | ||
* | ||
* @param int $sprintId | ||
* @return void | ||
*/ | ||
public function get_issues_in_sprints(int $sprintId) | ||
{ | ||
try { | ||
$sps = new SprintService(); | ||
|
||
$sprint = $sps->getSprintIssues($sprintId); | ||
|
||
$this->assertNotNull($sprint); | ||
Dumper::dump($sprint); | ||
} catch (Exception $e) { | ||
$this->fail('testSearch Failed : '.$e->getMessage()); | ||
} | ||
} | ||
} |