Skip to content

Commit b755f29

Browse files
committed
fix behat tests for redmine 4.2
1 parent f687904 commit b755f29

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

tests/Behat/Bootstrap/FeatureContext.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,24 @@ public function theReturnedDataPropertyContainsTheFollowingData($property, Table
290290
$this->assertTableNodeIsSameAsArray($table, $returnData);
291291
}
292292

293+
/**
294+
* @Then the returned data :property property contains the following data with Redmine version :versionComparision
295+
*/
296+
public function theReturnedDataPropertyContainsTheFollowingDataWithRedmineVersion($property, string $versionComparision, TableNode $table)
297+
{
298+
$parts = explode(' ', $versionComparision);
299+
300+
$redmineVersion = RedmineVersion::tryFrom($parts[1]);
301+
302+
if ($redmineVersion === null) {
303+
throw new InvalidArgumentException('Comparison with Redmine ' . $versionComparision . ' is not supported.');
304+
}
305+
306+
if (version_compare($this->redmine->getVersionString(), $parts[1], $parts[0])) {
307+
$this->theReturnedDataPropertyContainsTheFollowingData($property, $table);
308+
}
309+
}
310+
293311
/**
294312
* @Then the returned data :property property has only the following properties
295313
*/

tests/Behat/features/issue.feature

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,26 @@ Feature: Interacting with the REST API for issues
7777
And the returned data "status" property is an array
7878
And the returned data "status" property contains "1" items
7979
And the returned data "status.@attributes" property is an array
80-
And the returned data "status.@attributes" property has only the following properties
80+
And the returned data "status.@attributes" property has only the following properties with Redmine version ">= 5.0.0"
8181
"""
8282
id
8383
name
8484
is_closed
8585
"""
86-
And the returned data "status.@attributes" property contains the following data
86+
But the returned data "status.@attributes" property has only the following properties with Redmine version "< 5.0.0"
87+
"""
88+
id
89+
name
90+
"""
91+
And the returned data "status.@attributes" property contains the following data with Redmine version ">= 5.0.0"
8792
| property | value |
8893
| id | 1 |
8994
| name | New |
9095
| is_closed | false |
96+
But the returned data "status.@attributes" property contains the following data with Redmine version "< 5.0.0"
97+
| property | value |
98+
| id | 1 |
99+
| name | New |
91100
And the returned data "priority" property is an array
92101
And the returned data "priority" property contains "1" items
93102
And the returned data "priority.@attributes" property is an array

0 commit comments

Comments
 (0)