Skip to content

Commit 5977869

Browse files
committed
Improve behat tests for createing issue categories
1 parent a3c0dd7 commit 5977869

File tree

2 files changed

+20
-23
lines changed

2 files changed

+20
-23
lines changed

tests/Behat/Bootstrap/IssueCategoryContextTrait.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,19 @@
99

1010
trait IssueCategoryContextTrait
1111
{
12+
/**
13+
* @When I create an issue category for project identifier :identifier and with the name :name
14+
*/
15+
public function iCreateAnIssueCategoryForProjectIdentifierAndWithTheName($identifier, $name)
16+
{
17+
$table = new TableNode([
18+
['property', 'value'],
19+
['name', $name],
20+
]);
21+
22+
$this->iCreateAnIssueCategoryForProjectIdentifierAndWithTheFollowingData($identifier, $table);
23+
}
24+
1225
/**
1326
* @When I create an issue category for project identifier :identifier and with the following data
1427
*/

tests/Behat/features/issue_category.feature

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ Feature: Interacting with the REST API for issue categories
77
Scenario: Creating an issue category with miminal data
88
Given I have a "NativeCurlClient" client
99
And I create a project with name "Test Project" and identifier "test-project"
10-
When I create an issue category for project identifier "test-project" and with the following data
11-
| property | value |
12-
| name | Category name |
10+
When I create an issue category for project identifier "test-project" and with the name "Category name"
1311
Then the response has the status code "201"
1412
And the response has the content type "application/xml"
1513
And the returned data is an instance of "SimpleXMLElement"
@@ -101,12 +99,8 @@ Feature: Interacting with the REST API for issue categories
10199
Scenario: Listing of multiple issue categories
102100
Given I have a "NativeCurlClient" client
103101
And I create a project with name "Test Project" and identifier "test-project"
104-
And I create an issue category for project identifier "test-project" and with the following data
105-
| property | value |
106-
| name | Category name B |
107-
And I create an issue category for project identifier "test-project" and with the following data
108-
| property | value |
109-
| name | Category name A |
102+
And I create an issue category for project identifier "test-project" and with the name "Category name B"
103+
And I create an issue category for project identifier "test-project" and with the name "Category name A"
110104
When I list all issue categories for project identifier "test-project"
111105
Then the response has the status code "200"
112106
And the response has the content type "application/json"
@@ -154,12 +148,8 @@ Feature: Interacting with the REST API for issue categories
154148
Scenario: Listing of multiple issue category names
155149
Given I have a "NativeCurlClient" client
156150
And I create a project with name "Test Project" and identifier "test-project"
157-
And I create an issue category for project identifier "test-project" and with the following data
158-
| property | value |
159-
| name | Category name B |
160-
And I create an issue category for project identifier "test-project" and with the following data
161-
| property | value |
162-
| name | Category name A |
151+
And I create an issue category for project identifier "test-project" and with the name "Category name B"
152+
And I create an issue category for project identifier "test-project" and with the name "Category name A"
163153
When I list all issue category names for project identifier "test-project"
164154
Then the response has the status code "200"
165155
And the response has the content type "application/json"
@@ -171,10 +161,7 @@ Feature: Interacting with the REST API for issue categories
171161
Scenario: Updating an issue category with all data
172162
Given I have a "NativeCurlClient" client
173163
And I create a project with name "Test Project" and identifier "test-project"
174-
And I create an issue category for project identifier "test-project" and with the following data
175-
| property | value |
176-
| name | Category name |
177-
| assigned_to_id | 1 |
164+
And I create an issue category for project identifier "test-project" and with the name "Category name"
178165
When I update the issue category with id "1" and the following data
179166
| property | value |
180167
| name | New category name |
@@ -187,10 +174,7 @@ Feature: Interacting with the REST API for issue categories
187174
Scenario: Deleting an issue category
188175
Given I have a "NativeCurlClient" client
189176
And I create a project with name "Test Project" and identifier "test-project"
190-
And I create an issue category for project identifier "test-project" and with the following data
191-
| property | value |
192-
| name | Category name |
193-
| assigned_to_id | 1 |
177+
And I create an issue category for project identifier "test-project" and with the name "Category name"
194178
When I remove the issue category with id "1"
195179
Then the response has the status code "204"
196180
And the response has an empty content type

0 commit comments

Comments
 (0)