Skip to content

Commit 2bcffdd

Browse files
authored
Merge pull request #438 from kbsali/437-update-the-behat-tests-redmine-602-and-515-released
Add support for Redmine 6.0.2
2 parents 355a0b2 + 8ebb529 commit 2bcffdd

17 files changed

+277
-113
lines changed

.docker/PHP83-Dockerfile renamed to .docker/PHP-Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM php:8.3.3-fpm
1+
FROM php:8.3-fpm
22

33
RUN apt-get update
44
RUN apt-get --yes --no-install-recommends install \
@@ -32,7 +32,7 @@ RUN docker-php-ext-install -j$(nproc) \
3232
COPY build/php/opcache.ini /usr/local/etc/php/conf.d/
3333
COPY build/php/custom.ini /usr/local/etc/php/conf.d/
3434

35-
RUN pecl install xdebug-3.3.1 && docker-php-ext-enable xdebug
35+
RUN pecl install xdebug-3.4.0 && docker-php-ext-enable xdebug
3636

3737
RUN php --version
3838

.github/workflows/tests.yml

+49-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
operating-system: ["ubuntu-latest"]
16-
php: ["7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]
16+
php: ["7.4", "8.0", "8.1", "8.2", "8.3", "8.4", "8.5"]
1717

1818
steps:
1919
- name: Checkout
@@ -37,6 +37,54 @@ jobs:
3737
- name: Run tests
3838
run: vendor/bin/phpunit --no-coverage
3939

40+
# This does not work
41+
# behat:
42+
# name: Tests (Behat with PHP ${{ matrix.php }})
43+
# runs-on: ubuntu-latest
44+
45+
# services:
46+
# redmine-60002:
47+
# image: redmine:6.0.2
48+
# ports:
49+
# - "6002:3000"
50+
# env:
51+
# # Workaround: Remove secret for Rails 7.2 so it will be generated automatically
52+
# # @see https://github.com/docker-library/redmine/issues/349#issuecomment-2516634932
53+
# # REDMINE_SECRET_KEY_BASE: supersecretkey
54+
# REDMINE_PLUGINS_MIGRATE: true
55+
# volumes:
56+
# - /home/runner/work/_temp/redmine-60002_data/files:/usr/src/redmine/files
57+
# - /home/runner/work/_temp/redmine-60002_data/sqlite:/usr/src/redmine/sqlite
58+
# options: --health-cmd="wget -O /dev/null http://localhost:3000" --health-start-period=30s --health-interval=30s --health-timeout=30s --health-retries=3
59+
60+
# strategy:
61+
# fail-fast: false
62+
# matrix:
63+
# operating-system: ["ubuntu-latest"]
64+
# php: ["8.3"]
65+
66+
# steps:
67+
# - name: Checkout
68+
# uses: actions/checkout@v4
69+
# with:
70+
# fetch-depth: 2
71+
72+
# - name: Setup PHP, with composer and extensions
73+
# uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
74+
# with:
75+
# php-version: ${{ matrix.php }}
76+
# tools: phpunit
77+
# extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite
78+
# coverage: xdebug
79+
80+
# # Install composer dependencies and handle caching in one go.
81+
# # @link https://github.com/marketplace/actions/install-composer-dependencies
82+
# - name: "Install Composer dependencies"
83+
# uses: "ramsey/composer-install@v2"
84+
85+
# - name: Run behat
86+
# run: vendor/bin/behat --config tests/Behat/behat.yml --profile=github-actions --suite=redmine_60002
87+
4088
code-quality:
4189
name: Check ${{ matrix.tool }} (PHP ${{ matrix.php }})
4290
runs-on: ubuntu-latest

CHANGELOG.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12+
- Added support for PHP 8.4
13+
- Support for Redmine 6.0.x was added.
1214
- New class `Redmine\Http\HttpFactory` to create `Redmine\Http\Request` and `Redmine\Http\Response` instances.
1315

1416
### Changed
1517

16-
- Behaviour-driven tests are run against Redmine 5.1.4, 5.0.10 and 4.2.10.
18+
- Behaviour-driven tests are run against Redmine 6.0.2, 5.1.4, 5.0.10.
1719

1820
### Deprecated
1921

@@ -25,6 +27,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2527
- `Redmine\Client\Client::getLastResponseContentType()` is deprecated, use `\Redmine\Client\Client::request()` or `\Redmine\Api\AbstractApi::getLastResponse()->getContentType()` instead.
2628
- `Redmine\Client\Client::getLastResponseBody()` is deprecated, use `\Redmine\Client\Client::request()` or `\Redmine\Api\AbstractApi::getLastResponse()->getContent()` instead.
2729

30+
### Removed
31+
32+
- Support for Redmine 4.2.x was dropped.
33+
2834
## [v2.7.0](https://github.com/kbsali/php-redmine-api/compare/v2.6.0...v2.7.0) - 2024-07-10
2935

3036
### Added

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ like [Guzzle](https://github.com/guzzle/guzzle) for handling http connections
3838
We support (and run tests against) the [latest supported Redmine versions](https://www.redmine.org/projects/redmine/wiki/Download#Versions-status-and-releases-policy)
3939
that receive security updates.
4040

41+
- Redmine 6.0.x
4142
- Redmine 5.1.x
4243
- Redmine 5.0.x
43-
- Redmine 4.2.x
4444

4545
Nevertheless, you can also use this library for all older Redmine versions.
4646
In this case, however, be aware that some features might not be supported by your Redmine server.

composer.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@
5353
"scripts": {
5454
"bdt": [
5555
"Composer\\Config::disableProcessTimeout",
56-
"@behat --format=progress --suite=redmine_50104",
57-
"@behat --format=progress --suite=redmine_50010",
58-
"@behat --format=progress --suite=redmine_40210"
56+
"@behat --format=progress --suite=redmine_60002",
57+
"@behat --format=progress --suite=redmine_50105",
58+
"@behat --format=progress --suite=redmine_50010"
5959
],
6060
"behat": "behat --config tests/Behat/behat.yml",
6161
"codestyle": "php-cs-fixer fix",

docker-compose.yml

+23-23
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ services:
22
php:
33
build: # Info to build the Docker image
44
context: ./.docker # Specify where the Dockerfile is located (e.g. in the root directory of the project)
5-
dockerfile: PHP83-Dockerfile # Specify the name of the Dockerfile
5+
dockerfile: PHP-Dockerfile # Specify the name of the Dockerfile
66
ports:
77
- 8111:80
88
depends_on:
@@ -11,12 +11,13 @@ services:
1111
- ./:/var/www/project/ # Location of the project for php-fpm. Note this should be the same for NGINX.*
1212

1313
redmine-dev:
14-
image: redmine:5.1.4
15-
user: "1000:1000"
14+
image: redmine:6.0.2
1615
ports:
1716
- "3000:3000"
1817
environment:
19-
REDMINE_SECRET_KEY_BASE: supersecretkey
18+
# Workaround: Remove secret for Rails 7.2 so it will be generated automatically
19+
# @see https://github.com/docker-library/redmine/issues/349#issuecomment-2516634932
20+
# REDMINE_SECRET_KEY_BASE: supersecretkey
2021
REDMINE_PLUGINS_MIGRATE: true
2122
volumes:
2223
- ./.docker/redmine-dev_data/files:/usr/src/redmine/files
@@ -25,40 +26,39 @@ services:
2526
# Make sure the following services are configured in:
2627
# - /tests/Behat/behat.yml
2728

28-
redmine-50104:
29-
image: redmine:5.1.4
30-
user: "1000:1000"
29+
redmine-60002:
30+
image: redmine:6.0.2
3131
ports:
32-
- "5103:3000"
32+
- "6002:3000"
3333
environment:
34-
REDMINE_SECRET_KEY_BASE: supersecretkey
34+
# Workaround: Remove secret for Rails 7.2 so it will be generated automatically
35+
# @see https://github.com/docker-library/redmine/issues/349#issuecomment-2516634932
36+
# REDMINE_SECRET_KEY_BASE: supersecretkey
3537
REDMINE_PLUGINS_MIGRATE: true
3638
volumes:
37-
- ./.docker/redmine-50104_data/files:/usr/src/redmine/files
38-
- ./.docker/redmine-50104_data/sqlite:/usr/src/redmine/sqlite
39+
- ./.docker/redmine-60002_data/files:/usr/src/redmine/files
40+
- ./.docker/redmine-60002_data/sqlite:/usr/src/redmine/sqlite
3941

40-
redmine-50010:
41-
image: redmine:5.0.10
42+
redmine-50105:
43+
image: redmine:5.1.5
4244
user: "1000:1000"
4345
ports:
44-
- "5009:3000"
46+
- "5105:3000"
4547
environment:
4648
REDMINE_SECRET_KEY_BASE: supersecretkey
4749
REDMINE_PLUGINS_MIGRATE: true
4850
volumes:
49-
- ./.docker/redmine-50010_data/files:/usr/src/redmine/files
50-
- ./.docker/redmine-50010_data/sqlite:/usr/src/redmine/sqlite
51+
- ./.docker/redmine-50105_data/files:/usr/src/redmine/files
52+
- ./.docker/redmine-50105_data/sqlite:/usr/src/redmine/sqlite
5153

52-
redmine-40210:
53-
# Redmine 4.2.11 is not available on Docker Hub
54-
# @link https://hub.docker.com/_/redmine/tags?page=&page_size=&ordering=&name=4.2.11
55-
image: redmine:4.2.10
54+
redmine-50010:
55+
image: redmine:5.0.10
5656
user: "1000:1000"
5757
ports:
58-
- "4210:3000"
58+
- "5010:3000"
5959
environment:
6060
REDMINE_SECRET_KEY_BASE: supersecretkey
6161
REDMINE_PLUGINS_MIGRATE: true
6262
volumes:
63-
- ./.docker/redmine-40210_data/files:/usr/src/redmine/files
64-
- ./.docker/redmine-40210_data/sqlite:/usr/src/redmine/sqlite
63+
- ./.docker/redmine-50010_data/files:/usr/src/redmine/files
64+
- ./.docker/redmine-50010_data/sqlite:/usr/src/redmine/sqlite

tests/Behat/Bootstrap/FeatureContext.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,15 @@ public static function clean(AfterSuiteScope $scope)
8181
*/
8282
private array $lastReturnAsArray;
8383

84-
public function __construct(string $redmineVersion)
84+
public function __construct(string $redmineVersion, string $rootPath)
8585
{
8686
$version = RedmineVersion::tryFrom($redmineVersion);
8787

8888
if ($version === null) {
8989
throw new InvalidArgumentException('Redmine ' . $redmineVersion . ' is not supported.');
9090
}
9191

92-
$this->redmine = static::$tracer::getRedmineInstance($version);
92+
$this->redmine = static::$tracer::getRedmineInstance($version, $rootPath);
9393

9494
parent::__construct('BehatRedmine' . $version->asId());
9595
}

tests/Behat/behat.yml

+26-10
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,38 @@
11
default:
22
suites:
3-
redmine_50104:
3+
default:
44
paths:
55
- '%paths.base%/features'
6+
redmine_60002:
67
contexts:
78
- Redmine\Tests\Behat\Bootstrap\FeatureContext:
8-
redmineVersion: '5.1.4'
9+
redmineVersion: '6.0.2'
10+
rootPath: '%paths.base%/../../.docker'
11+
redmine_50105:
12+
contexts:
13+
- Redmine\Tests\Behat\Bootstrap\FeatureContext:
14+
redmineVersion: '5.1.5'
15+
rootPath: '%paths.base%/../../.docker'
916
redmine_50010:
10-
paths:
11-
- '%paths.base%/features'
1217
contexts:
1318
- Redmine\Tests\Behat\Bootstrap\FeatureContext:
1419
redmineVersion: '5.0.10'
15-
redmine_40210:
16-
paths:
17-
- '%paths.base%/features'
20+
rootPath: '%paths.base%/../../.docker'
21+
22+
github-actions:
23+
suites:
24+
redmine_60002:
1825
contexts:
1926
- Redmine\Tests\Behat\Bootstrap\FeatureContext:
20-
redmineVersion: '4.2.10'
21-
filters:
22-
tags: "~@since50000"
27+
redmineVersion: '6.0.2'
28+
rootPath: '/home/runner/work/_temp'
29+
redmine_50105:
30+
contexts:
31+
- Redmine\Tests\Behat\Bootstrap\FeatureContext:
32+
redmineVersion: '5.1.5'
33+
rootPath: '/home/runner/work/_temp'
34+
redmine_50010:
35+
contexts:
36+
- Redmine\Tests\Behat\Bootstrap\FeatureContext:
37+
redmineVersion: '5.0.10'
38+
rootPath: '/home/runner/work/_temp'

tests/Behat/features/attachments.feature

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ Feature: Interacting with the REST API for attachments
2626
| id | 1 |
2727
| token | 1.7b962f8af22e26802b87abfa0b07b21dbd03b984ec8d6888dabd3f69cff162f8 |
2828

29-
3029
Scenario: Updating the details of an attachment
3130
Given I have a "NativeCurlClient" client
3231
And I create a project with name "Test Project" and identifier "test-project"

tests/Behat/features/issue.feature

+2-11
Original file line numberDiff line numberDiff line change
@@ -77,26 +77,17 @@ 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 with Redmine version ">= 5.0.0"
80+
And the returned data "status.@attributes" property has only the following properties
8181
"""
8282
id
8383
name
8484
is_closed
8585
"""
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"
86+
And the returned data "status.@attributes" property contains the following data
9287
| property | value |
9388
| id | 1 |
9489
| name | New |
9590
| 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 |
10091
And the returned data "priority" property is an array
10192
And the returned data "priority" property contains "1" items
10293
And the returned data "priority.@attributes" property is an array

tests/Behat/features/projects.feature

+1-5
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ Feature: Interacting with the REST API for projects
183183
And the response has the content ""
184184
And the returned data is exactly ""
185185

186-
@since50000
187186
Scenario: Closing a project
188187
Given I have a "NativeCurlClient" client
189188
And I create a project with name "Test Project" and identifier "test-project"
@@ -197,7 +196,6 @@ Feature: Interacting with the REST API for projects
197196
| property | value |
198197
| status | 5 |
199198

200-
@since50000
201199
Scenario: Reopening a project
202200
Given I have a "NativeCurlClient" client
203201
And I create a project with name "Test Project" and identifier "test-project"
@@ -212,7 +210,6 @@ Feature: Interacting with the REST API for projects
212210
| property | value |
213211
| status | 1 |
214212

215-
@since50000
216213
Scenario: Archiving a project
217214
Given I have a "NativeCurlClient" client
218215
And I create a project with name "Test Project" and identifier "test-project"
@@ -222,7 +219,7 @@ Feature: Interacting with the REST API for projects
222219
And the response has the content ""
223220
And the returned data is true
224221

225-
@since50000 @error
222+
@error
226223
Scenario: Showing an archived project is not possible
227224
Given I have a "NativeCurlClient" client
228225
And I create a project with name "Test Project" and identifier "test-project"
@@ -233,7 +230,6 @@ Feature: Interacting with the REST API for projects
233230
And the response has the content ""
234231
And the returned data is false
235232

236-
@since50000
237233
Scenario: Unarchiving a project
238234
Given I have a "NativeCurlClient" client
239235
And I create a project with name "Test Project" and identifier "test-project"

tests/Behat/features/tracker.feature

+1-8
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,14 @@ Feature: Interacting with the REST API for trackers
3131
And the returned data "trackers" property is an array
3232
And the returned data "trackers" property contains "2" items
3333
And the returned data "trackers.0" property is an array
34-
And the returned data "trackers.0" property has only the following properties with Redmine version ">= 5.0.0"
34+
And the returned data "trackers.0" property has only the following properties
3535
"""
3636
id
3737
name
3838
default_status
3939
description
4040
enabled_standard_fields
4141
"""
42-
But the returned data "trackers.0" property has only the following properties with Redmine version "< 5.0.0"
43-
"""
44-
id
45-
name
46-
default_status
47-
description
48-
"""
4942
And the returned data "trackers.0" property contains the following data
5043
| property | value |
5144
| id | 1 |

0 commit comments

Comments
 (0)