Skip to content

Commit d10cd98

Browse files
committed
Add behat tests for Tracker::list()
1 parent 7161d27 commit d10cd98

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed

tests/Behat/Bootstrap/TrackerContextTrait.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace Redmine\Tests\Behat\Bootstrap;
66

7+
use Redmine\Api\Tracker;
8+
79
trait TrackerContextTrait
810
{
911
/**
@@ -24,4 +26,18 @@ public function iHaveATrackerWithTheNameAndDefaultStatusId(string $trackerName,
2426
],
2527
);
2628
}
29+
30+
/**
31+
* @When I list all trackers
32+
*/
33+
public function iListAllTrackers()
34+
{
35+
/** @var Tracker */
36+
$api = $this->getNativeCurlClient()->getApi('tracker');
37+
38+
$this->registerClientResponse(
39+
$api->list(),
40+
$api->getLastResponse(),
41+
);
42+
}
2743
}

tests/Behat/features/tracker.feature

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
@tracker
2+
Feature: Interacting with the REST API for trackers
3+
In order to interact with REST API for trackers
4+
As a user
5+
I want to make sure the Redmine server replies with the correct response
6+
7+
Scenario: Listing of zero trackers
8+
Given I have a "NativeCurlClient" client
9+
When I list all trackers
10+
Then the response has the status code "200"
11+
And the response has the content type "application/json"
12+
And the returned data has only the following properties
13+
"""
14+
trackers
15+
"""
16+
And the returned data "trackers" property is an array
17+
And the returned data "trackers" property contains "0" items
18+
19+
Scenario: Listing of multiple trackers
20+
Given I have a "NativeCurlClient" client
21+
And I have an issue status with the name "New"
22+
And I have a tracker with the name "Feature" and default status id "1"
23+
And I have a tracker with the name "Defect" and default status id "1"
24+
When I list all trackers
25+
Then the response has the status code "200"
26+
And the response has the content type "application/json"
27+
And the returned data has only the following properties
28+
"""
29+
trackers
30+
"""
31+
And the returned data "trackers" property is an array
32+
And the returned data "trackers" property contains "2" items
33+
And the returned data "trackers.0" property is an array
34+
And the returned data "trackers.0" property has only the following properties
35+
"""
36+
id
37+
name
38+
default_status
39+
description
40+
enabled_standard_fields
41+
"""
42+
And the returned data "trackers.0" property contains the following data
43+
| property | value |
44+
| id | 1 |
45+
| name | Feature |
46+
| description | null |
47+
And the returned data "trackers.0.default_status" property contains the following data
48+
| property | value |
49+
| id | 1 |
50+
| name | New |
51+
And the returned data "trackers.0.enabled_standard_fields" property contains the following data
52+
| property | value |
53+
| 0 | assigned_to_id |
54+
| 1 | category_id |
55+
| 2 | fixed_version_id |
56+
| 3 | parent_issue_id |
57+
| 4 | start_date |
58+
| 5 | due_date |
59+
| 6 | estimated_hours |
60+
| 7 | done_ratio |
61+
| 8 | description |
62+
| 9 | priority_id |

0 commit comments

Comments
 (0)