|
1 | 1 | <?php |
2 | 2 |
|
3 | | -require 'vendor/autoload.php'; |
4 | | -require_once 'config.jira.php'; |
5 | | - |
6 | 3 | use JiraRestApi\Project\ProjectService; |
7 | 4 |
|
8 | 5 | class ProjectTest extends PHPUnit_Framework_TestCase |
9 | 6 | { |
10 | | - public function testProjectLists() |
| 7 | + public function testGetProject() |
11 | 8 | { |
| 9 | + //$this->markTestIncomplete(); |
12 | 10 | try { |
13 | | - $proj = new ProjectService($jira_config, $options); |
14 | | - |
15 | | - //$ret = $proj->getAllProjects(); |
| 11 | + $proj = new ProjectService(getHostConfig(), getOptions()); |
| 12 | + |
| 13 | + $p = $proj->get('TEST'); |
| 14 | + |
| 15 | + print_r($p->lead); |
| 16 | + foreach ($p->components as $c) { |
| 17 | + echo ("COM : " . $c->name . "\n"); |
| 18 | + } |
| 19 | + } catch (HTTPException $e) { |
| 20 | + $this->assertTrue(FALSE, $e->getMessage()); |
| 21 | + } |
| 22 | + } |
16 | 23 |
|
17 | | - /* |
18 | | - $mapper = new JsonMapper(); |
19 | | - $mapper->bExceptionOnUndefinedProperty = true; |
| 24 | + public function testGetProjectLists() |
| 25 | + { |
| 26 | + $this->markTestIncomplete(); |
| 27 | + try { |
| 28 | + $proj = new ProjectService(getHostConfig(), getOptions()); |
20 | 29 |
|
21 | | - $prjs = $mapper->mapArray( |
22 | | - json_decode($ret), new ArrayObject(), '\JiraRestApi\Project\Project' |
23 | | - ); |
24 | | - var_dump($prjs); |
25 | | - */ |
26 | | - $p = $proj->get('BITA'); |
27 | | - var_dump($p); |
| 30 | + $prjs = $proj->getAllProjects(); |
28 | 31 |
|
29 | | - //$project = $mapper->map($ret, new Project()); |
30 | | - //var_dump($project); |
| 32 | + $i = 0; |
| 33 | + foreach ($prjs as $p) { |
| 34 | + echo sprintf("Project Key:%s, Id:%s, Name:%s, projectCategory: %s\n", |
| 35 | + $p->key, $p->id, $p->name, $p->projectCategory['name'] |
| 36 | + ); |
| 37 | + |
| 38 | + } |
31 | 39 | } catch (HTTPException $e) { |
32 | | - var_dump($e); |
| 40 | + $this->assertTrue(FALSE, $e->getMessage()); |
33 | 41 | } |
34 | 42 | } |
35 | 43 | // |
|
0 commit comments