diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 735b0fcf..81e12c0b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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: @@ -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: @@ -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 }}) diff --git a/CHANGELOG.md b/CHANGELOG.md index a58351ad..961e6e1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/composer.json b/composer.json index 704bff58..dcf4b537 100644 --- a/composer.json +++ b/composer.json @@ -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", diff --git a/docker-compose.yml b/docker-compose.yml index 794e3d7f..7122596b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: @@ -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: @@ -36,11 +36,11 @@ 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" @@ -48,11 +48,11 @@ services: 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" @@ -60,5 +60,5 @@ services: 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 diff --git a/tests/Behat/Bootstrap/FeatureContext.php b/tests/Behat/Bootstrap/FeatureContext.php index d617dd1b..48af4c9f 100644 --- a/tests/Behat/Bootstrap/FeatureContext.php +++ b/tests/Behat/Bootstrap/FeatureContext.php @@ -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'] . '"'); diff --git a/tests/Behat/README.md b/tests/Behat/README.md index 10929722..fc61eb18 100644 --- a/tests/Behat/README.md +++ b/tests/Behat/README.md @@ -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 @@ -64,10 +64,10 @@ 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 [...] ``` @@ -75,7 +75,7 @@ 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" @@ -88,10 +88,10 @@ or default: suites: [...] - redmine_40210: + redmine_5_1: [...] filters: - tags: "~@since50000" + tags: "~@since60000" ``` @@ -125,7 +125,7 @@ or default: suites: [...] - redmine_60000: + redmine_6_0: [...] filters: tags: "~@until60000" diff --git a/tests/Behat/behat.yml b/tests/Behat/behat.yml index f8a6d7f0..1a6a3ccb 100644 --- a/tests/Behat/behat.yml +++ b/tests/Behat/behat.yml @@ -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' diff --git a/tests/Behat/features/attachments.feature b/tests/Behat/features/attachments.feature index 26b7ad2d..c731f3e2 100644 --- a/tests/Behat/features/attachments.feature +++ b/tests/Behat/features/attachments.feature @@ -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 | diff --git a/tests/Behat/features/wiki.feature b/tests/Behat/features/wiki.feature index 2d28610f..c1b6ec67 100644 --- a/tests/Behat/features/wiki.feature +++ b/tests/Behat/features/wiki.feature @@ -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 """ diff --git a/tests/RedmineExtension/RedmineInstance.php b/tests/RedmineExtension/RedmineInstance.php index 547917b7..e5f52708 100644 --- a/tests/RedmineExtension/RedmineInstance.php +++ b/tests/RedmineExtension/RedmineInstance.php @@ -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); diff --git a/tests/RedmineExtension/RedmineVersion.php b/tests/RedmineExtension/RedmineVersion.php index 976c7e81..e5acedcc 100644 --- a/tests/RedmineExtension/RedmineVersion.php +++ b/tests/RedmineExtension/RedmineVersion.php @@ -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 * @@ -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 * @@ -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 *