Skip to content

Commit 030ae2b

Browse files
committed
Add behat tests for list issue categories
1 parent f29d8b2 commit 030ae2b

File tree

2 files changed

+83
-0
lines changed

2 files changed

+83
-0
lines changed

tests/Behat/Bootstrap/IssueCategoryContextTrait.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,20 @@ public function iCreateAnIssueCategoryForProjectIdentifierAndWithTheFollowingDat
2929
);
3030
}
3131

32+
/**
33+
* @When I list all issue categories for project identifier :identifier
34+
*/
35+
public function iListAllIssueCategoriesForProjectIdentifier($identifier)
36+
{
37+
/** @var IssueCategory */
38+
$api = $this->getNativeCurlClient()->getApi('issue_category');
39+
40+
$this->registerClientResponse(
41+
$api->listByProject($identifier),
42+
$api->getLastResponse(),
43+
);
44+
}
45+
3246
/**
3347
* @When I update the issue category with id :id and the following data
3448
*/

tests/Behat/features/issue_category.feature

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,75 @@ Feature: Interacting with the REST API for issue categories
8383
| id | 1 |
8484
| name | Redmine Admin |
8585

86+
Scenario: Listing of zero issue categories
87+
Given I have a "NativeCurlClient" client
88+
And I create a project with name "Test Project" and identifier "test-project"
89+
When I list all issue categories for project identifier "test-project"
90+
Then the response has the status code "200"
91+
And the response has the content type "application/json"
92+
And the returned data has only the following properties
93+
"""
94+
issue_categories
95+
total_count
96+
"""
97+
And the returned data contains the following data
98+
| property | value |
99+
| issue_categories | [] |
100+
| total_count | 0 |
101+
102+
Scenario: Listing of multiple issue categories
103+
Given I have a "NativeCurlClient" client
104+
And I create a project with name "Test Project" and identifier "test-project"
105+
And I create an issue category for project identifier "test-project" and with the following data
106+
| property | value |
107+
| name | Category name B |
108+
And I create an issue category for project identifier "test-project" and with the following data
109+
| property | value |
110+
| name | Category name A |
111+
When I list all issue categories for project identifier "test-project"
112+
Then the response has the status code "200"
113+
And the response has the content type "application/json"
114+
And the returned data has only the following properties
115+
"""
116+
issue_categories
117+
total_count
118+
"""
119+
And the returned data contains the following data
120+
| property | value |
121+
| total_count | 2 |
122+
And the returned data "issue_categories" property is an array
123+
And the returned data "issue_categories" property contains "2" items
124+
And the returned data "issue_categories.0" property is an array
125+
And the returned data "issue_categories.0" property has only the following properties
126+
"""
127+
id
128+
project
129+
name
130+
"""
131+
And the returned data "issue_categories.0" property contains the following data
132+
| property | value |
133+
| id | 2 |
134+
| name | Category name A |
135+
And the returned data "issue_categories.0.project" property contains the following data
136+
| property | value |
137+
| id | 1 |
138+
| name | Test Project |
139+
And the returned data "issue_categories.1" property is an array
140+
And the returned data "issue_categories.1" property has only the following properties
141+
"""
142+
id
143+
project
144+
name
145+
"""
146+
And the returned data "issue_categories.1" property contains the following data
147+
| property | value |
148+
| id | 1 |
149+
| name | Category name B |
150+
And the returned data "issue_categories.1.project" property contains the following data
151+
| property | value |
152+
| id | 1 |
153+
| name | Test Project |
154+
86155
@issue_category
87156
Scenario: Updating an issue category with all data
88157
Given I have a "NativeCurlClient" client

0 commit comments

Comments
 (0)