Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ jobs:
# runs-on: ubuntu-latest

# services:
# redmine-60005:
# image: redmine:6.0.5
# redmine-6-0:
# image: redmine:6.0.7
# ports:
# - "5060:3000"
# env:
Expand All @@ -53,8 +53,8 @@ jobs:
# # REDMINE_SECRET_KEY_BASE: supersecretkey
# REDMINE_PLUGINS_MIGRATE: true
# volumes:
# - /home/runner/work/_temp/redmine-60005_data/files:/usr/src/redmine/files
# - /home/runner/work/_temp/redmine-60005_data/sqlite:/usr/src/redmine/sqlite
# - /home/runner/work/_temp/redmine-60007_data/files:/usr/src/redmine/files
# - /home/runner/work/_temp/redmine-60007_data/sqlite:/usr/src/redmine/sqlite
# options: --health-cmd="wget -O /dev/null http://localhost:3000" --health-start-period=30s --health-interval=30s --health-timeout=30s --health-retries=3

# strategy:
Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:
# uses: "ramsey/composer-install@v2"

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

code-quality:
name: Check ${{ matrix.tool }} (PHP ${{ matrix.php }})
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

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

Nothing yet.
### Changed

- Behaviour-driven tests are run against Redmine 6.0.7, 5.1.10, 5.0.14.

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

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@
"scripts": {
"bdt": [
"Composer\\Config::disableProcessTimeout",
"@behat --format=progress --suite=redmine_60005",
"@behat --format=progress --suite=redmine_50108",
"@behat --format=progress --suite=redmine_50012"
"@behat --format=progress --suite=redmine_6_0",
"@behat --format=progress --suite=redmine_5_1",
"@behat --format=progress --suite=redmine_5_0"
],
"behat": "behat --config tests/Behat/behat.yml",
"codestyle": "php-cs-fixer fix",
Expand Down
26 changes: 13 additions & 13 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
- ./:/var/www/project/ # Location of the project for php-fpm. Note this should be the same for NGINX.*

redmine-dev:
image: redmine:6.0.5
image: redmine:6.0.7
ports:
- "3000:3000"
environment:
Expand All @@ -26,8 +26,8 @@ services:
# Make sure the following services are configured in:
# - /tests/Behat/behat.yml

redmine-60005:
image: redmine:6.0.5
redmine-6-0:
image: redmine:6.0.7
ports:
- "5060:3000"
environment:
Expand All @@ -36,29 +36,29 @@ services:
# REDMINE_SECRET_KEY_BASE: supersecretkey
REDMINE_PLUGINS_MIGRATE: true
volumes:
- ./.docker/redmine-60005_data/files:/usr/src/redmine/files
- ./.docker/redmine-60005_data/sqlite:/usr/src/redmine/sqlite
- ./.docker/redmine-60007_data/files:/usr/src/redmine/files
- ./.docker/redmine-60007_data/sqlite:/usr/src/redmine/sqlite

redmine-50108:
image: redmine:5.1.8
redmine-5-1:
image: redmine:5.1.10
user: "1000:1000"
ports:
- "5051:3000"
environment:
REDMINE_SECRET_KEY_BASE: supersecretkey
REDMINE_PLUGINS_MIGRATE: true
volumes:
- ./.docker/redmine-50108_data/files:/usr/src/redmine/files
- ./.docker/redmine-50108_data/sqlite:/usr/src/redmine/sqlite
- ./.docker/redmine-50110_data/files:/usr/src/redmine/files
- ./.docker/redmine-50110_data/sqlite:/usr/src/redmine/sqlite

redmine-50012:
image: redmine:5.0.12
redmine-5-0:
image: redmine:5.0.12 # There is no tag for 5.0.14 on Docker hub
user: "1000:1000"
ports:
- "5050:3000"
environment:
REDMINE_SECRET_KEY_BASE: supersecretkey
REDMINE_PLUGINS_MIGRATE: true
volumes:
- ./.docker/redmine-50012_data/files:/usr/src/redmine/files
- ./.docker/redmine-50012_data/sqlite:/usr/src/redmine/sqlite
- ./.docker/redmine-50014_data/files:/usr/src/redmine/files
- ./.docker/redmine-50014_data/sqlite:/usr/src/redmine/sqlite
4 changes: 2 additions & 2 deletions tests/Behat/Bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -431,9 +431,9 @@ private function assertTableNodeIsSameAsArray(TableNode $table, array $data)
$expected = false;
}

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

TestCase::assertSame($expected, $value, 'Error with property "' . $row['property'] . '"');
Expand Down
18 changes: 9 additions & 9 deletions tests/Behat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ you can use the `behat` command directly:

```bash
# test only a specific redmine version
docker compose exec php composer behat -- --suite=redmine_50104
docker compose exec php composer behat -- --suite=redmine_6_0
# test only specific endpoints
docker compose exec php composer behat -- --tags=issue,group
# test only specific endpoints on a specific redmine version
docker compose exec php composer behat -- --suite=redmine_50104 --tags=issue,group
docker compose exec php composer behat -- --suite=redmine_6_0 --tags=issue,group
# test only a specific redmine version and format the output as `progress` (default is `pretty`)
docker compose exec php composer behat -- --suite=redmine_50104 --format=progress
docker compose exec php composer behat -- --suite=redmine_6_0 --format=progress
```

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

1. Tag features or scenarios e.g. with `@since50000`.
1. Tag features or scenarios e.g. with `@since60000`.

```
@since50000
@since60000
Feature: Interacting with the new REST API endpoint
[...]
```

or

```
@since50000
@since60000
Scenario: Using a new feature
Given I have a "NativeCurlClient" client
And I create a project with name "Test Project" and identifier "test-project"
Expand All @@ -88,10 +88,10 @@ or
default:
suites:
[...]
redmine_40210:
redmine_5_1:
[...]
filters:
tags: "~@since50000"
tags: "~@since60000"

```

Expand Down Expand Up @@ -125,7 +125,7 @@ or
default:
suites:
[...]
redmine_60000:
redmine_6_0:
[...]
filters:
tags: "~@until60000"
Expand Down
24 changes: 12 additions & 12 deletions tests/Behat/behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,36 @@ default:
default:
paths:
- '%paths.base%/features'
redmine_60005:
redmine_6_0:
contexts:
- Redmine\Tests\Behat\Bootstrap\FeatureContext:
redmineVersion: '6.0.5'
redmineVersion: '6.0.7'
rootPath: '%paths.base%/../../.docker'
redmine_50108:
redmine_5_1:
contexts:
- Redmine\Tests\Behat\Bootstrap\FeatureContext:
redmineVersion: '5.1.8'
redmineVersion: '5.1.10'
rootPath: '%paths.base%/../../.docker'
redmine_50012:
redmine_5_0:
contexts:
- Redmine\Tests\Behat\Bootstrap\FeatureContext:
redmineVersion: '5.0.12'
redmineVersion: '5.0.14'
rootPath: '%paths.base%/../../.docker'

github-actions:
suites:
redmine_60005:
redmine_6_0:
contexts:
- Redmine\Tests\Behat\Bootstrap\FeatureContext:
redmineVersion: '6.0.5'
redmineVersion: '6.0.7'
rootPath: '/home/runner/work/_temp'
redmine_50108:
redmine_5_1:
contexts:
- Redmine\Tests\Behat\Bootstrap\FeatureContext:
redmineVersion: '5.1.8'
redmineVersion: '5.1.10'
rootPath: '/home/runner/work/_temp'
redmine_50012:
redmine_5_0:
contexts:
- Redmine\Tests\Behat\Bootstrap\FeatureContext:
redmineVersion: '5.0.12'
redmineVersion: '5.0.14'
rootPath: '/home/runner/work/_temp'
2 changes: 1 addition & 1 deletion tests/Behat/features/attachments.feature
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Feature: Interacting with the REST API for attachments
| filesize | 65 |
| content_type | text/plain |
| description | null |
| content_url | http://redmine-%redmine_id%:3000/attachments/download/1/testfile.txt |
| content_url | %redmine_base_url%/attachments/download/1/testfile.txt |
And the returned data "attachment.author" property is an array
And the returned data "attachment.author" property contains the following data
| property | value |
Expand Down
2 changes: 1 addition & 1 deletion tests/Behat/features/wiki.feature
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ Feature: Interacting with the REST API for wikis
| filesize | 65 |
| content_type | text/plain |
| description | |
| content_url | http://redmine-%redmine_id%:3000/attachments/download/1/filename.txt |
| content_url | %redmine_base_url%/attachments/download/1/filename.txt |
And the returned data "wiki_page.attachments.0.author" property is an array
And the returned data "wiki_page.attachments.0.author" property has only the following properties
"""
Expand Down
4 changes: 3 additions & 1 deletion tests/RedmineExtension/RedmineInstance.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ private function __construct(InstanceRegistration $tracer, RedmineVersion $versi
$this->migratedFiles = 'files-migrated/';
$this->backupFiles = 'files-bak/';

$this->redmineUrl = 'http://redmine-' . $versionId . ':3000';
$parts = explode('.', $version->asString());

$this->redmineUrl = 'http://redmine-' . intval($parts[0]) . '-' . intval($parts[1]) . ':3000';
$this->apiKey = sha1($versionId . (string) time());

$this->runHealthChecks($version);
Expand Down
50 changes: 50 additions & 0 deletions tests/RedmineExtension/RedmineVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,22 @@

enum RedmineVersion: string
{
/**
* Redmine 6.0.7
*
* @link https://www.redmine.org/versions/213
* @link https://www.redmine.org/projects/redmine/wiki/Changelog_6_0#607-2025-09-21
*/
case V6_0_7 = '6.0.7';

/**
* Redmine 6.0.6
*
* @link https://www.redmine.org/versions/211
* @link https://www.redmine.org/projects/redmine/wiki/Changelog_6_0#606-2025-07-07
*/
case V6_0_6 = '6.0.6';

/**
* Redmine 6.0.5
*
Expand Down Expand Up @@ -54,6 +70,22 @@ enum RedmineVersion: string
*/
case V6_0_0 = '6.0.0';

/**
* Redmine 5.1.10
*
* @link https://www.redmine.org/versions/214
* @link https://www.redmine.org/projects/redmine/wiki/Changelog_5_1#5110-2025-09-21
*/
case V5_1_10 = '5.1.10';

/**
* Redmine 5.1.9
*
* @link https://www.redmine.org/versions/210
* @link https://www.redmine.org/projects/redmine/wiki/Changelog_5_1#519-2025-07-07
*/
case V5_1_9 = '5.1.9';

/**
* Redmine 5.1.8
*
Expand Down Expand Up @@ -126,6 +158,24 @@ enum RedmineVersion: string
*/
case V5_1_0 = '5.1.0';

/**
* Redmine 5.0.14
*
* @link https://www.redmine.org/versions/215
* @link https://www.redmine.org/projects/redmine/wiki/Changelog_5_0#5014-2025-09-21
*/

case V5_0_14 = '5.0.14';

/**
* Redmine 5.0.13
*
* @link https://www.redmine.org/versions/212
* @link https://www.redmine.org/projects/redmine/wiki/Changelog_5_0#5013-2025-07-07
*/

case V5_0_13 = '5.0.13';

/**
* Redmine 5.0.12
*
Expand Down