Skip to content

Commit ef5d168

Browse files
authored
Merge pull request #452 from Art4/add-support-redmine-50-51-60
Add support for Redmine 5.0.13, 5.0.14, 5.1.9, 5.1.10, 6.0.6, 6.0.7
2 parents da184cc + ac720c5 commit ef5d168

File tree

11 files changed

+102
-48
lines changed

11 files changed

+102
-48
lines changed

.github/workflows/tests.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ jobs:
4343
# runs-on: ubuntu-latest
4444

4545
# services:
46-
# redmine-60005:
47-
# image: redmine:6.0.5
46+
# redmine-6-0:
47+
# image: redmine:6.0.7
4848
# ports:
4949
# - "5060:3000"
5050
# env:
@@ -53,8 +53,8 @@ jobs:
5353
# # REDMINE_SECRET_KEY_BASE: supersecretkey
5454
# REDMINE_PLUGINS_MIGRATE: true
5555
# volumes:
56-
# - /home/runner/work/_temp/redmine-60005_data/files:/usr/src/redmine/files
57-
# - /home/runner/work/_temp/redmine-60005_data/sqlite:/usr/src/redmine/sqlite
56+
# - /home/runner/work/_temp/redmine-60007_data/files:/usr/src/redmine/files
57+
# - /home/runner/work/_temp/redmine-60007_data/sqlite:/usr/src/redmine/sqlite
5858
# options: --health-cmd="wget -O /dev/null http://localhost:3000" --health-start-period=30s --health-interval=30s --health-timeout=30s --health-retries=3
5959

6060
# strategy:
@@ -83,7 +83,7 @@ jobs:
8383
# uses: "ramsey/composer-install@v2"
8484

8585
# - name: Run behat
86-
# run: vendor/bin/behat --config tests/Behat/behat.yml --profile=github-actions --suite=redmine_60005
86+
# run: vendor/bin/behat --config tests/Behat/behat.yml --profile=github-actions --suite=redmine_6_0
8787

8888
code-quality:
8989
name: Check ${{ matrix.tool }} (PHP ${{ matrix.php }})

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased](https://github.com/kbsali/php-redmine-api/compare/v2.8.0...v2.x)
99

10-
Nothing yet.
10+
### Changed
11+
12+
- Behaviour-driven tests are run against Redmine 6.0.7, 5.1.10, 5.0.14.
1113

1214
## [v2.8.0](https://github.com/kbsali/php-redmine-api/compare/v2.7.0...v2.8.0) - 2025-05-30
1315

composer.json

Lines changed: 3 additions & 3 deletions
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_60005",
57-
"@behat --format=progress --suite=redmine_50108",
58-
"@behat --format=progress --suite=redmine_50012"
56+
"@behat --format=progress --suite=redmine_6_0",
57+
"@behat --format=progress --suite=redmine_5_1",
58+
"@behat --format=progress --suite=redmine_5_0"
5959
],
6060
"behat": "behat --config tests/Behat/behat.yml",
6161
"codestyle": "php-cs-fixer fix",

docker-compose.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ 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:6.0.5
14+
image: redmine:6.0.7
1515
ports:
1616
- "3000:3000"
1717
environment:
@@ -26,8 +26,8 @@ services:
2626
# Make sure the following services are configured in:
2727
# - /tests/Behat/behat.yml
2828

29-
redmine-60005:
30-
image: redmine:6.0.5
29+
redmine-6-0:
30+
image: redmine:6.0.7
3131
ports:
3232
- "5060:3000"
3333
environment:
@@ -36,29 +36,29 @@ services:
3636
# REDMINE_SECRET_KEY_BASE: supersecretkey
3737
REDMINE_PLUGINS_MIGRATE: true
3838
volumes:
39-
- ./.docker/redmine-60005_data/files:/usr/src/redmine/files
40-
- ./.docker/redmine-60005_data/sqlite:/usr/src/redmine/sqlite
39+
- ./.docker/redmine-60007_data/files:/usr/src/redmine/files
40+
- ./.docker/redmine-60007_data/sqlite:/usr/src/redmine/sqlite
4141

42-
redmine-50108:
43-
image: redmine:5.1.8
42+
redmine-5-1:
43+
image: redmine:5.1.10
4444
user: "1000:1000"
4545
ports:
4646
- "5051:3000"
4747
environment:
4848
REDMINE_SECRET_KEY_BASE: supersecretkey
4949
REDMINE_PLUGINS_MIGRATE: true
5050
volumes:
51-
- ./.docker/redmine-50108_data/files:/usr/src/redmine/files
52-
- ./.docker/redmine-50108_data/sqlite:/usr/src/redmine/sqlite
51+
- ./.docker/redmine-50110_data/files:/usr/src/redmine/files
52+
- ./.docker/redmine-50110_data/sqlite:/usr/src/redmine/sqlite
5353

54-
redmine-50012:
55-
image: redmine:5.0.12
54+
redmine-5-0:
55+
image: redmine:5.0.12 # There is no tag for 5.0.14 on Docker hub
5656
user: "1000:1000"
5757
ports:
5858
- "5050:3000"
5959
environment:
6060
REDMINE_SECRET_KEY_BASE: supersecretkey
6161
REDMINE_PLUGINS_MIGRATE: true
6262
volumes:
63-
- ./.docker/redmine-50012_data/files:/usr/src/redmine/files
64-
- ./.docker/redmine-50012_data/sqlite:/usr/src/redmine/sqlite
63+
- ./.docker/redmine-50014_data/files:/usr/src/redmine/files
64+
- ./.docker/redmine-50014_data/sqlite:/usr/src/redmine/sqlite

tests/Behat/Bootstrap/FeatureContext.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,9 +431,9 @@ private function assertTableNodeIsSameAsArray(TableNode $table, array $data)
431431
$expected = false;
432432
}
433433

434-
// Handle placeholder %redmine_id%
434+
// Handle placeholder %redmine_base_url%
435435
if (is_string($expected)) {
436-
$expected = str_replace('%redmine_id%', strval($this->redmine->getVersionId()), $expected);
436+
$expected = str_replace('%redmine_base_url%', $this->redmine->getRedmineUrl(), $expected);
437437
}
438438

439439
TestCase::assertSame($expected, $value, 'Error with property "' . $row['property'] . '"');

tests/Behat/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ you can use the `behat` command directly:
2222

2323
```bash
2424
# test only a specific redmine version
25-
docker compose exec php composer behat -- --suite=redmine_50104
25+
docker compose exec php composer behat -- --suite=redmine_6_0
2626
# test only specific endpoints
2727
docker compose exec php composer behat -- --tags=issue,group
2828
# test only specific endpoints on a specific redmine version
29-
docker compose exec php composer behat -- --suite=redmine_50104 --tags=issue,group
29+
docker compose exec php composer behat -- --suite=redmine_6_0 --tags=issue,group
3030
# test only a specific redmine version and format the output as `progress` (default is `pretty`)
31-
docker compose exec php composer behat -- --suite=redmine_50104 --format=progress
31+
docker compose exec php composer behat -- --suite=redmine_6_0 --format=progress
3232
```
3333

3434
## Redmine version specific features
@@ -64,18 +64,18 @@ A new Redmine version could introduce new REST-API endpoints.
6464
Tests for this endpoint should not be run on older Redmine versions.
6565
This can be handled on the `scenario` or `feature` layer.
6666

67-
1. Tag features or scenarios e.g. with `@since50000`.
67+
1. Tag features or scenarios e.g. with `@since60000`.
6868

6969
```
70-
@since50000
70+
@since60000
7171
Feature: Interacting with the new REST API endpoint
7272
[...]
7373
```
7474

7575
or
7676

7777
```
78-
@since50000
78+
@since60000
7979
Scenario: Using a new feature
8080
Given I have a "NativeCurlClient" client
8181
And I create a project with name "Test Project" and identifier "test-project"
@@ -88,10 +88,10 @@ or
8888
default:
8989
suites:
9090
[...]
91-
redmine_40210:
91+
redmine_5_1:
9292
[...]
9393
filters:
94-
tags: "~@since50000"
94+
tags: "~@since60000"
9595
9696
```
9797

@@ -125,7 +125,7 @@ or
125125
default:
126126
suites:
127127
[...]
128-
redmine_60000:
128+
redmine_6_0:
129129
[...]
130130
filters:
131131
tags: "~@until60000"

tests/Behat/behat.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,36 @@ default:
33
default:
44
paths:
55
- '%paths.base%/features'
6-
redmine_60005:
6+
redmine_6_0:
77
contexts:
88
- Redmine\Tests\Behat\Bootstrap\FeatureContext:
9-
redmineVersion: '6.0.5'
9+
redmineVersion: '6.0.7'
1010
rootPath: '%paths.base%/../../.docker'
11-
redmine_50108:
11+
redmine_5_1:
1212
contexts:
1313
- Redmine\Tests\Behat\Bootstrap\FeatureContext:
14-
redmineVersion: '5.1.8'
14+
redmineVersion: '5.1.10'
1515
rootPath: '%paths.base%/../../.docker'
16-
redmine_50012:
16+
redmine_5_0:
1717
contexts:
1818
- Redmine\Tests\Behat\Bootstrap\FeatureContext:
19-
redmineVersion: '5.0.12'
19+
redmineVersion: '5.0.14'
2020
rootPath: '%paths.base%/../../.docker'
2121

2222
github-actions:
2323
suites:
24-
redmine_60005:
24+
redmine_6_0:
2525
contexts:
2626
- Redmine\Tests\Behat\Bootstrap\FeatureContext:
27-
redmineVersion: '6.0.5'
27+
redmineVersion: '6.0.7'
2828
rootPath: '/home/runner/work/_temp'
29-
redmine_50108:
29+
redmine_5_1:
3030
contexts:
3131
- Redmine\Tests\Behat\Bootstrap\FeatureContext:
32-
redmineVersion: '5.1.8'
32+
redmineVersion: '5.1.10'
3333
rootPath: '/home/runner/work/_temp'
34-
redmine_50012:
34+
redmine_5_0:
3535
contexts:
3636
- Redmine\Tests\Behat\Bootstrap\FeatureContext:
37-
redmineVersion: '5.0.12'
37+
redmineVersion: '5.0.14'
3838
rootPath: '/home/runner/work/_temp'

tests/Behat/features/attachments.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Feature: Interacting with the REST API for attachments
7171
| filesize | 65 |
7272
| content_type | text/plain |
7373
| description | null |
74-
| content_url | http://redmine-%redmine_id%:3000/attachments/download/1/testfile.txt |
74+
| content_url | %redmine_base_url%/attachments/download/1/testfile.txt |
7575
And the returned data "attachment.author" property is an array
7676
And the returned data "attachment.author" property contains the following data
7777
| property | value |

tests/Behat/features/wiki.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ Feature: Interacting with the REST API for wikis
205205
| filesize | 65 |
206206
| content_type | text/plain |
207207
| description | |
208-
| content_url | http://redmine-%redmine_id%:3000/attachments/download/1/filename.txt |
208+
| content_url | %redmine_base_url%/attachments/download/1/filename.txt |
209209
And the returned data "wiki_page.attachments.0.author" property is an array
210210
And the returned data "wiki_page.attachments.0.author" property has only the following properties
211211
"""

tests/RedmineExtension/RedmineInstance.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ private function __construct(InstanceRegistration $tracer, RedmineVersion $versi
6363
$this->migratedFiles = 'files-migrated/';
6464
$this->backupFiles = 'files-bak/';
6565

66-
$this->redmineUrl = 'http://redmine-' . $versionId . ':3000';
66+
$parts = explode('.', $version->asString());
67+
68+
$this->redmineUrl = 'http://redmine-' . intval($parts[0]) . '-' . intval($parts[1]) . ':3000';
6769
$this->apiKey = sha1($versionId . (string) time());
6870

6971
$this->runHealthChecks($version);

0 commit comments

Comments
 (0)