Skip to content

Commit 472027f

Browse files
committed
Add behat test for listing custom fields
1 parent b118039 commit 472027f

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Redmine\Tests\Behat\Bootstrap;
6+
7+
use Redmine\Api\CustomField;
8+
9+
trait CustomFieldContextTrait
10+
{
11+
/**
12+
* @When I list all custom fields
13+
*/
14+
public function iListAllCustomFields()
15+
{
16+
/** @var CustomField */
17+
$api = $this->getNativeCurlClient()->getApi('custom_fields');
18+
19+
$this->registerClientResponse(
20+
$api->list(),
21+
$api->getLastResponse(),
22+
);
23+
}
24+
}

tests/Behat/Bootstrap/FeatureContext.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
final class FeatureContext extends TestCase implements Context
2424
{
2525
use AttachmentContextTrait;
26+
use CustomFieldContextTrait;
2627
use GroupContextTrait;
2728
use IssueCategoryContextTrait;
2829
use IssueContextTrait;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@custom_field
2+
Feature: Interacting with the REST API for custom fields
3+
In order to interact with REST API for custom fields
4+
As a user
5+
I want to make sure the Redmine server replies with the correct response
6+
7+
Scenario: Listing of zero custom fields
8+
Given I have a "NativeCurlClient" client
9+
When I list all custom fields
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+
custom_fields
15+
"""
16+
And the returned data "custom_fields" property is an array
17+
And the returned data "custom_fields" property contains "0" items

0 commit comments

Comments
 (0)