File tree Expand file tree Collapse file tree 3 files changed +51
-0
lines changed Expand file tree Collapse file tree 3 files changed +51
-0
lines changed Original file line number Diff line number Diff line change 25
25
26
26
final class FeatureContext extends TestCase implements Context
27
27
{
28
+ use GroupContextTrait;
28
29
use ProjectContextTrait;
29
30
30
31
private static ?BehatHookTracer $ tracer = null ;
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace Redmine \Tests \Behat \Bootstrap ;
6
+
7
+ use Behat \Behat \Tester \Exception \PendingException ;
8
+ use Behat \Gherkin \Node \TableNode ;
9
+ use Redmine \Api \Group ;
10
+
11
+ trait GroupContextTrait
12
+ {
13
+ /**
14
+ * @When I create a group with name :groupName
15
+ */
16
+ public function iCreateAGroupWithName (string $ groupName )
17
+ {
18
+ $ data = [
19
+ 'name ' => $ groupName ,
20
+ ];
21
+
22
+ /** @var Group */
23
+ $ groupApi = $ this ->getNativeCurlClient ()->getApi ('group ' );
24
+
25
+ $ this ->registerClientResponse (
26
+ $ groupApi ->create ($ data ),
27
+ $ groupApi ->getLastResponse ()
28
+ );
29
+ }
30
+ }
Original file line number Diff line number Diff line change
1
+ Feature : Interacting with the REST API for groups
2
+ In order to interact with REST API for groups
3
+ As a user
4
+ I want to make sure the Redmine server replies with the correct response
5
+
6
+ Scenario : Creating a group with minimal parameters
7
+ Given I have a "NativeCurlClient" client
8
+ When I create a group with name "Test Group"
9
+ Then the response has the status code "201"
10
+ And the response has the content type "application/xml"
11
+ And the returned data is an instance of "SimpleXMLElement"
12
+ And the returned data has only the following properties
13
+ """
14
+ id
15
+ name
16
+ """
17
+ And the returned data has proterties with the following data
18
+ | property | value |
19
+ | id | 4 |
20
+ | name | Test Group |
You can’t perform that action at this time.
0 commit comments