Skip to content

Commit 9d58cf7

Browse files
committed
Add behat test for IssueStatus::list()
1 parent 35bb710 commit 9d58cf7

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed

tests/Behat/Bootstrap/IssueStatusContextTrait.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\IssueStatus;
8+
79
trait IssueStatusContextTrait
810
{
911
/**
@@ -22,4 +24,18 @@ public function iHaveAnIssueStatusWithTheName($issueStatusName)
2224
],
2325
);
2426
}
27+
28+
/**
29+
* @When I list all issue statuses
30+
*/
31+
public function iListAllIssueStatuses()
32+
{
33+
/** @var IssueStatus */
34+
$api = $this->getNativeCurlClient()->getApi('issue_status');
35+
36+
$this->registerClientResponse(
37+
$api->list(),
38+
$api->getLastResponse(),
39+
);
40+
}
2541
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
@issue_status
2+
Feature: Interacting with the REST API for issue statuses
3+
In order to interact with REST API for issue statuses
4+
As a user
5+
I want to make sure the Redmine server replies with the correct response
6+
7+
Scenario: Listing of zero issue statuses
8+
Given I have a "NativeCurlClient" client
9+
When I list all issue statuses
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+
issue_statuses
15+
"""
16+
And the returned data "issue_statuses" property is an array
17+
And the returned data "issue_statuses" property contains "0" items
18+
19+
Scenario: Listing of multiple issue statuses
20+
Given I have a "NativeCurlClient" client
21+
And I have an issue status with the name "New"
22+
And I have an issue status with the name "Done"
23+
When I list all issue statuses
24+
Then the response has the status code "200"
25+
And the response has the content type "application/json"
26+
And the returned data has only the following properties
27+
"""
28+
issue_statuses
29+
"""
30+
And the returned data "issue_statuses" property is an array
31+
And the returned data "issue_statuses" property contains "2" items
32+
# field 'description' was added in Redmine 5.1.0, see https://www.redmine.org/issues/2568
33+
And the returned data "issue_statuses.0" property contains the following data with Redmine version ">= 5.1.0"
34+
| property | value |
35+
| id | 1 |
36+
| name | New |
37+
| is_closed | false |
38+
| description | null |
39+
But the returned data "issue_statuses.0" property contains the following data with Redmine version "< 5.1.0"
40+
| property | value |
41+
| id | 1 |
42+
| name | New |
43+
| is_closed | false |
44+
# field 'description' was added in Redmine 5.1.0, see https://www.redmine.org/issues/2568
45+
And the returned data "issue_statuses.1" property contains the following data with Redmine version ">= 5.1.0"
46+
| property | value |
47+
| id | 2 |
48+
| name | Done |
49+
| is_closed | false |
50+
| description | null |
51+
But the returned data "issue_statuses.1" property contains the following data with Redmine version "< 5.1.0"
52+
| property | value |
53+
| id | 2 |
54+
| name | Done |
55+
| is_closed | false |

0 commit comments

Comments
 (0)