From 4b7e9248f837defe7ec0fd9b31ab32a202027354 Mon Sep 17 00:00:00 2001 From: Art4 Date: Wed, 15 Jan 2025 08:37:50 +0100 Subject: [PATCH 01/24] Add redmine versions for 5.1.5, 6.0.0, 6.0.1 and 6.0.2 --- tests/RedmineExtension/RedmineVersion.php | 48 +++++++++++++++++++---- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/tests/RedmineExtension/RedmineVersion.php b/tests/RedmineExtension/RedmineVersion.php index 2278bb08..f51721f5 100644 --- a/tests/RedmineExtension/RedmineVersion.php +++ b/tests/RedmineExtension/RedmineVersion.php @@ -6,6 +6,38 @@ enum RedmineVersion: string { + /** + * Redmine 6.0.2 + * + * @link https://www.redmine.org/versions/202 + * @link https://www.redmine.org/projects/redmine/wiki/Changelog_6_0#602-2024-12-11 + */ + case V6_0_2 = '6.0.2'; + + /** + * Redmine 6.0.1 + * + * @link https://www.redmine.org/versions/201 + * @link https://www.redmine.org/projects/redmine/wiki/Changelog_6_0#601-2024-11-12 + */ + case V6_0_1 = '6.0.1'; + + /** + * Redmine 6.0.0 + * + * @link https://www.redmine.org/versions/175 + * @link https://www.redmine.org/projects/redmine/wiki/Changelog_6_0#600-2024-11-10 + */ + case V6_0_0 = '6.0.0'; + + /** + * Redmine 5.1.5 + * + * @link https://www.redmine.org/versions/199 + * @link https://www.redmine.org/projects/redmine/wiki/Changelog_5_1#515-2024-12-11 + */ + case V5_1_5 = '5.1.5'; + /** * Redmine 5.1.4 * @@ -47,22 +79,22 @@ enum RedmineVersion: string case V5_1_0 = '5.1.0'; /** - * Redmine 5.0.9 + * Redmine 5.0.10 * - * @link https://www.redmine.org/versions/194 - * @link https://www.redmine.org/projects/redmine/wiki/Changelog_5_0#509-2024-06-11 + * @link https://www.redmine.org/versions/196 + * @link https://www.redmine.org/projects/redmine/wiki/Changelog_5_0#5010-2024-11-03 */ - case V5_0_9 = '5.0.9'; + case V5_0_10 = '5.0.10'; /** - * Redmine 5.0.10 + * Redmine 5.0.9 * - * @link https://www.redmine.org/versions/196 - * @link https://www.redmine.org/projects/redmine/wiki/Changelog_5_0#5010-2024-11-03 + * @link https://www.redmine.org/versions/194 + * @link https://www.redmine.org/projects/redmine/wiki/Changelog_5_0#509-2024-06-11 */ - case V5_0_10 = '5.0.10'; + case V5_0_9 = '5.0.9'; /** * Redmine 5.0.8 From 17afb3092ca99cc2fa5828303a109ce57659b154 Mon Sep 17 00:00:00 2001 From: Art4 Date: Wed, 15 Jan 2025 08:46:17 +0100 Subject: [PATCH 02/24] Remove support for Redmine 4.2.x --- CHANGELOG.md | 4 ++++ README.md | 1 - composer.json | 3 +-- docker-compose.yml | 14 -------------- tests/Behat/behat.yml | 8 -------- tests/Behat/features/projects.feature | 6 +----- 6 files changed, 6 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e5f2938a..4aa2ee3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `Redmine\Client\Client::getLastResponseContentType()` is deprecated, use `\Redmine\Client\Client::request()` or `\Redmine\Api\AbstractApi::getLastResponse()->getContentType()` instead. - `Redmine\Client\Client::getLastResponseBody()` is deprecated, use `\Redmine\Client\Client::request()` or `\Redmine\Api\AbstractApi::getLastResponse()->getContent()` instead. +### Removed + +- Support for Redmine 4.2.x was dropped. + ## [v2.7.0](https://github.com/kbsali/php-redmine-api/compare/v2.6.0...v2.7.0) - 2024-07-10 ### Added diff --git a/README.md b/README.md index 58564f4e..e1480c25 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,6 @@ that receive security updates. - Redmine 5.1.x - Redmine 5.0.x -- Redmine 4.2.x Nevertheless, you can also use this library for all older Redmine versions. In this case, however, be aware that some features might not be supported by your Redmine server. diff --git a/composer.json b/composer.json index 1a618191..9e8cf539 100644 --- a/composer.json +++ b/composer.json @@ -54,8 +54,7 @@ "bdt": [ "Composer\\Config::disableProcessTimeout", "@behat --format=progress --suite=redmine_50104", - "@behat --format=progress --suite=redmine_50010", - "@behat --format=progress --suite=redmine_40210" + "@behat --format=progress --suite=redmine_50010" ], "behat": "behat --config tests/Behat/behat.yml", "codestyle": "php-cs-fixer fix", diff --git a/docker-compose.yml b/docker-compose.yml index 88a70c35..17a1c9c8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -48,17 +48,3 @@ services: volumes: - ./.docker/redmine-50010_data/files:/usr/src/redmine/files - ./.docker/redmine-50010_data/sqlite:/usr/src/redmine/sqlite - - redmine-40210: - # Redmine 4.2.11 is not available on Docker Hub - # @link https://hub.docker.com/_/redmine/tags?page=&page_size=&ordering=&name=4.2.11 - image: redmine:4.2.10 - user: "1000:1000" - ports: - - "4210:3000" - environment: - REDMINE_SECRET_KEY_BASE: supersecretkey - REDMINE_PLUGINS_MIGRATE: true - volumes: - - ./.docker/redmine-40210_data/files:/usr/src/redmine/files - - ./.docker/redmine-40210_data/sqlite:/usr/src/redmine/sqlite diff --git a/tests/Behat/behat.yml b/tests/Behat/behat.yml index da16bc83..8c728d9d 100644 --- a/tests/Behat/behat.yml +++ b/tests/Behat/behat.yml @@ -12,11 +12,3 @@ default: contexts: - Redmine\Tests\Behat\Bootstrap\FeatureContext: redmineVersion: '5.0.10' - redmine_40210: - paths: - - '%paths.base%/features' - contexts: - - Redmine\Tests\Behat\Bootstrap\FeatureContext: - redmineVersion: '4.2.10' - filters: - tags: "~@since50000" diff --git a/tests/Behat/features/projects.feature b/tests/Behat/features/projects.feature index 63612182..8aa43b47 100644 --- a/tests/Behat/features/projects.feature +++ b/tests/Behat/features/projects.feature @@ -183,7 +183,6 @@ Feature: Interacting with the REST API for projects And the response has the content "" And the returned data is exactly "" - @since50000 Scenario: Closing a project Given I have a "NativeCurlClient" client 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 | property | value | | status | 5 | - @since50000 Scenario: Reopening a project Given I have a "NativeCurlClient" client 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 | property | value | | status | 1 | - @since50000 Scenario: Archiving a project Given I have a "NativeCurlClient" client 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 And the response has the content "" And the returned data is true - @since50000 @error + @error Scenario: Showing an archived project is not possible Given I have a "NativeCurlClient" client 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 And the response has the content "" And the returned data is false - @since50000 Scenario: Unarchiving a project Given I have a "NativeCurlClient" client And I create a project with name "Test Project" and identifier "test-project" From 87b30a2756de82d458203a29f4d3d2c1fd54734b Mon Sep 17 00:00:00 2001 From: Art4 Date: Wed, 15 Jan 2025 08:47:45 +0100 Subject: [PATCH 03/24] Fix code style --- tests/RedmineExtension/RedmineVersion.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/RedmineExtension/RedmineVersion.php b/tests/RedmineExtension/RedmineVersion.php index f51721f5..13f3f6d8 100644 --- a/tests/RedmineExtension/RedmineVersion.php +++ b/tests/RedmineExtension/RedmineVersion.php @@ -85,7 +85,7 @@ enum RedmineVersion: string * @link https://www.redmine.org/projects/redmine/wiki/Changelog_5_0#5010-2024-11-03 */ - case V5_0_10 = '5.0.10'; + case V5_0_10 = '5.0.10'; /** * Redmine 5.0.9 From 16d6de915367e02ddd7a1536363f34cb0faaec38 Mon Sep 17 00:00:00 2001 From: Art4 Date: Mon, 20 Jan 2025 11:05:24 +0100 Subject: [PATCH 04/24] update redmine 5.1.4 to 5.1.5, use 6.0.2 for development --- docker-compose.yml | 15 +++++++-------- tests/Behat/behat.yml | 4 ++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 17a1c9c8..dcc6cb4b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,8 +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:5.1.4 - user: "1000:1000" + image: redmine:6.0.2 ports: - "3000:3000" environment: @@ -25,23 +24,23 @@ services: # Make sure the following services are configured in: # - /tests/Behat/behat.yml - redmine-50104: - image: redmine:5.1.4 + redmine-50105: + image: redmine:5.1.5 user: "1000:1000" ports: - - "5103:3000" + - "5105:3000" environment: REDMINE_SECRET_KEY_BASE: supersecretkey REDMINE_PLUGINS_MIGRATE: true volumes: - - ./.docker/redmine-50104_data/files:/usr/src/redmine/files - - ./.docker/redmine-50104_data/sqlite:/usr/src/redmine/sqlite + - ./.docker/redmine-50105_data/files:/usr/src/redmine/files + - ./.docker/redmine-50105_data/sqlite:/usr/src/redmine/sqlite redmine-50010: image: redmine:5.0.10 user: "1000:1000" ports: - - "5009:3000" + - "5010:3000" environment: REDMINE_SECRET_KEY_BASE: supersecretkey REDMINE_PLUGINS_MIGRATE: true diff --git a/tests/Behat/behat.yml b/tests/Behat/behat.yml index 8c728d9d..2ccd2c7b 100644 --- a/tests/Behat/behat.yml +++ b/tests/Behat/behat.yml @@ -1,11 +1,11 @@ default: suites: - redmine_50104: + redmine_50105: paths: - '%paths.base%/features' contexts: - Redmine\Tests\Behat\Bootstrap\FeatureContext: - redmineVersion: '5.1.4' + redmineVersion: '5.1.5' redmine_50010: paths: - '%paths.base%/features' From 9939780e447b2411e0b7d5bb01b9db33c70a097a Mon Sep 17 00:00:00 2001 From: Art4 Date: Mon, 20 Jan 2025 12:53:07 +0100 Subject: [PATCH 05/24] Workaround to fix bug with secret in Rails 7.2 --- docker-compose.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index dcc6cb4b..53eadb7b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,7 +15,9 @@ services: ports: - "3000:3000" environment: - REDMINE_SECRET_KEY_BASE: supersecretkey + # Workaround: Remove secret for Rails 7.2 so it will be generated automatically + # @see https://github.com/docker-library/redmine/issues/349#issuecomment-2516634932 + # REDMINE_SECRET_KEY_BASE: supersecretkey REDMINE_PLUGINS_MIGRATE: true volumes: - ./.docker/redmine-dev_data/files:/usr/src/redmine/files From 4e2f11b11e557fc48a0051714df46be99886b88d Mon Sep 17 00:00:00 2001 From: Art4 Date: Mon, 20 Jan 2025 13:11:33 +0100 Subject: [PATCH 06/24] Add support and behat tests for Redmine 6.0.2 --- CHANGELOG.md | 3 ++- README.md | 1 + composer.json | 3 ++- docker-compose.yml | 13 +++++++++++++ tests/Behat/behat.yml | 6 ++++++ 5 files changed, 24 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4aa2ee3e..9c6ea43c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,11 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- Support for Redmine 6.0.x was added. - New class `Redmine\Http\HttpFactory` to create `Redmine\Http\Request` and `Redmine\Http\Response` instances. ### Changed -- Behaviour-driven tests are run against Redmine 5.1.4, 5.0.10 and 4.2.10. +- Behaviour-driven tests are run against Redmine 6.0.2, 5.1.4, 5.0.10. ### Deprecated diff --git a/README.md b/README.md index e1480c25..7b08a74c 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ like [Guzzle](https://github.com/guzzle/guzzle) for handling http connections We support (and run tests against) the [latest supported Redmine versions](https://www.redmine.org/projects/redmine/wiki/Download#Versions-status-and-releases-policy) that receive security updates. +- Redmine 6.0.x - Redmine 5.1.x - Redmine 5.0.x diff --git a/composer.json b/composer.json index 9e8cf539..abfc01db 100644 --- a/composer.json +++ b/composer.json @@ -53,7 +53,8 @@ "scripts": { "bdt": [ "Composer\\Config::disableProcessTimeout", - "@behat --format=progress --suite=redmine_50104", + "@behat --format=progress --suite=redmine_60002", + "@behat --format=progress --suite=redmine_50105", "@behat --format=progress --suite=redmine_50010" ], "behat": "behat --config tests/Behat/behat.yml", diff --git a/docker-compose.yml b/docker-compose.yml index 53eadb7b..b30adf57 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,6 +26,19 @@ services: # Make sure the following services are configured in: # - /tests/Behat/behat.yml + redmine-60002: + image: redmine:6.0.2 + ports: + - "6002:3000" + environment: + # Workaround: Remove secret for Rails 7.2 so it will be generated automatically + # @see https://github.com/docker-library/redmine/issues/349#issuecomment-2516634932 + # REDMINE_SECRET_KEY_BASE: supersecretkey + REDMINE_PLUGINS_MIGRATE: true + volumes: + - ./.docker/redmine-60002_data/files:/usr/src/redmine/files + - ./.docker/redmine-60002_data/sqlite:/usr/src/redmine/sqlite + redmine-50105: image: redmine:5.1.5 user: "1000:1000" diff --git a/tests/Behat/behat.yml b/tests/Behat/behat.yml index 2ccd2c7b..f8b98022 100644 --- a/tests/Behat/behat.yml +++ b/tests/Behat/behat.yml @@ -1,5 +1,11 @@ default: suites: + redmine_60002: + paths: + - '%paths.base%/features' + contexts: + - Redmine\Tests\Behat\Bootstrap\FeatureContext: + redmineVersion: '6.0.2' redmine_50105: paths: - '%paths.base%/features' From 067e4b2c02816f5d20c8b9e0a0d587e2fcd2b5ac Mon Sep 17 00:00:00 2001 From: Art4 Date: Mon, 20 Jan 2025 13:24:54 +0100 Subject: [PATCH 07/24] Remove behat test cases for Redmine < 5.0.0 --- tests/Behat/features/issue.feature | 13 ++----------- tests/Behat/features/tracker.feature | 9 +-------- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/tests/Behat/features/issue.feature b/tests/Behat/features/issue.feature index a8932171..40ecb6d6 100644 --- a/tests/Behat/features/issue.feature +++ b/tests/Behat/features/issue.feature @@ -77,26 +77,17 @@ Feature: Interacting with the REST API for issues And the returned data "status" property is an array And the returned data "status" property contains "1" items And the returned data "status.@attributes" property is an array - And the returned data "status.@attributes" property has only the following properties with Redmine version ">= 5.0.0" + And the returned data "status.@attributes" property has only the following properties """ id name is_closed """ - But the returned data "status.@attributes" property has only the following properties with Redmine version "< 5.0.0" - """ - id - name - """ - And the returned data "status.@attributes" property contains the following data with Redmine version ">= 5.0.0" + And the returned data "status.@attributes" property contains the following data | property | value | | id | 1 | | name | New | | is_closed | false | - But the returned data "status.@attributes" property contains the following data with Redmine version "< 5.0.0" - | property | value | - | id | 1 | - | name | New | And the returned data "priority" property is an array And the returned data "priority" property contains "1" items And the returned data "priority.@attributes" property is an array diff --git a/tests/Behat/features/tracker.feature b/tests/Behat/features/tracker.feature index a8a888e1..ef044510 100644 --- a/tests/Behat/features/tracker.feature +++ b/tests/Behat/features/tracker.feature @@ -31,7 +31,7 @@ Feature: Interacting with the REST API for trackers And the returned data "trackers" property is an array And the returned data "trackers" property contains "2" items And the returned data "trackers.0" property is an array - And the returned data "trackers.0" property has only the following properties with Redmine version ">= 5.0.0" + And the returned data "trackers.0" property has only the following properties """ id name @@ -39,13 +39,6 @@ Feature: Interacting with the REST API for trackers description enabled_standard_fields """ - But the returned data "trackers.0" property has only the following properties with Redmine version "< 5.0.0" - """ - id - name - default_status - description - """ And the returned data "trackers.0" property contains the following data | property | value | | id | 1 | From 16eada129fdf6c9ab8046321e9f8f1292c4faabd Mon Sep 17 00:00:00 2001 From: Art4 Date: Mon, 20 Jan 2025 16:34:27 +0100 Subject: [PATCH 08/24] Improve backups for SQLite databases using SQLite3 class --- tests/Behat/features/attachments.feature | 1 - tests/Behat/features/version.feature | 1 - tests/RedmineExtension/RedmineInstance.php | 37 +++++++++++++++++++--- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/tests/Behat/features/attachments.feature b/tests/Behat/features/attachments.feature index 215b4243..26b7ad2d 100644 --- a/tests/Behat/features/attachments.feature +++ b/tests/Behat/features/attachments.feature @@ -26,7 +26,6 @@ Feature: Interacting with the REST API for attachments | id | 1 | | token | 1.7b962f8af22e26802b87abfa0b07b21dbd03b984ec8d6888dabd3f69cff162f8 | - Scenario: Updating the details of an attachment Given I have a "NativeCurlClient" client And I create a project with name "Test Project" and identifier "test-project" diff --git a/tests/Behat/features/version.feature b/tests/Behat/features/version.feature index 263fd7e0..463dd4df 100644 --- a/tests/Behat/features/version.feature +++ b/tests/Behat/features/version.feature @@ -162,7 +162,6 @@ Feature: Interacting with the REST API for versions | id | 1 | | name | Test Project | - @wip Scenario: Listing of multiple version names Given I have a "NativeCurlClient" client And I create a project with name "Test Project 1" and identifier "test-project-1" diff --git a/tests/RedmineExtension/RedmineInstance.php b/tests/RedmineExtension/RedmineInstance.php index fcb5b578..e4aa2a36 100644 --- a/tests/RedmineExtension/RedmineInstance.php +++ b/tests/RedmineExtension/RedmineInstance.php @@ -7,6 +7,7 @@ use DateTimeImmutable; use InvalidArgumentException; use PDO; +use SQLite3; final class RedmineInstance { @@ -190,7 +191,14 @@ private function runDatabaseMigration() */ private function createDatabaseBackup() { - copy($this->rootPath . $this->workingDB, $this->rootPath . $this->backupDB); + $workingDB = new SQLite3($this->rootPath . $this->workingDB); + + $backupDB = new SQLite3($this->rootPath . $this->backupDB); + + $workingDB->backup($backupDB); + + $workingDB->close(); + $backupDB->close(); } /** @@ -198,17 +206,38 @@ private function createDatabaseBackup() */ private function saveMigratedDatabase() { - copy($this->rootPath . $this->workingDB, $this->rootPath . $this->migratedDB); + $workingDB = new SQLite3($this->rootPath . $this->workingDB); + + $migratedDB = new SQLite3($this->rootPath . $this->migratedDB); + + $workingDB->backup($migratedDB); + + $workingDB->close(); + $migratedDB->close(); } private function restoreFromMigratedDatabase(): void { - copy($this->rootPath . $this->migratedDB, $this->rootPath . $this->workingDB); + $workingDB = new SQLite3($this->rootPath . $this->workingDB); + + $migratedDB = new SQLite3($this->rootPath . $this->migratedDB); + + $migratedDB->backup($workingDB); + + $workingDB->close(); + $migratedDB->close(); } private function restoreDatabaseFromBackup(): void { - copy($this->rootPath . $this->backupDB, $this->rootPath . $this->workingDB); + $workingDB = new SQLite3($this->rootPath . $this->workingDB); + + $backupDB = new SQLite3($this->rootPath . $this->backupDB); + + $backupDB->backup($workingDB); + + $workingDB->close(); + $backupDB->close(); } private function removeDatabaseBackups(): void From 07c5795ab0775c27503af91091dbf600b12d7eea Mon Sep 17 00:00:00 2001 From: Art4 Date: Tue, 21 Jan 2025 08:35:39 +0100 Subject: [PATCH 09/24] Add test for support of status in user list --- tests/Behat/features/user.feature | 58 ++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 4 deletions(-) diff --git a/tests/Behat/features/user.feature b/tests/Behat/features/user.feature index b1562081..07ccc515 100644 --- a/tests/Behat/features/user.feature +++ b/tests/Behat/features/user.feature @@ -120,7 +120,7 @@ Feature: Interacting with the REST API for users And the returned data "users" property is an array And the returned data "users" property contains "2" items And the returned data "users.0" property is an array - And the returned data "users.0" property has only the following properties + And the returned data "users.0" property has only the following properties with Redmine version ">= 6.0.0" """ id login @@ -133,8 +133,33 @@ Feature: Interacting with the REST API for users last_login_on passwd_changed_on twofa_scheme + status + """ + But the returned data "users.0" property has only the following properties with Redmine version "< 6.0.0" """ - And the returned data "users.0" property contains the following data + id + login + admin + firstname + lastname + mail + created_on + updated_on + last_login_on + passwd_changed_on + twofa_scheme + """ + And the returned data "users.0" property contains the following data with Redmine version ">= 6.0.0" + | property | value | + | id | 1 | + | login | admin | + | admin | true | + | firstname | Redmine | + | lastname | Admin | + | mail | admin@example.net | + | twofa_scheme | null | + | status | 1 | + But the returned data "users.0" property contains the following data with Redmine version "< 6.0.0" | property | value | | id | 1 | | login | admin | @@ -144,7 +169,7 @@ Feature: Interacting with the REST API for users | mail | admin@example.net | | twofa_scheme | null | And the returned data "users.1" property is an array - And the returned data "users.1" property has only the following properties + And the returned data "users.1" property has only the following properties with Redmine version ">= 6.0.0" """ id login @@ -157,8 +182,33 @@ Feature: Interacting with the REST API for users last_login_on passwd_changed_on twofa_scheme + status + """ + But the returned data "users.1" property has only the following properties with Redmine version "< 6.0.0" """ - And the returned data "users.1" property contains the following data + id + login + admin + firstname + lastname + mail + created_on + updated_on + last_login_on + passwd_changed_on + twofa_scheme + """ + And the returned data "users.1" property contains the following data with Redmine version ">= 6.0.0" + | property | value | + | id | 5 | + | login | username | + | admin | false | + | firstname | first | + | lastname | last | + | mail | mail@example.net | + | twofa_scheme | null | + | status | 1 | + And the returned data "users.1" property contains the following data with Redmine version "< 6.0.0" | property | value | | id | 5 | | login | username | From 8c57573ce9eddbcbe1fd8c1a5382a3c1e6edecc7 Mon Sep 17 00:00:00 2001 From: Art4 Date: Tue, 21 Jan 2025 09:25:51 +0100 Subject: [PATCH 10/24] Try run behat tests in github actions --- .github/workflows/tests.yml | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f5dda41b..63c16a53 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -37,6 +37,52 @@ jobs: - name: Run tests run: vendor/bin/phpunit --no-coverage + behat: + name: Tests (Behat with PHP ${{ matrix.php }}) + runs-on: ubuntu-latest + + services: + redmine-60002: + image: redmine:6.0.2 + ports: + - "6002:3000" + env: + # Workaround: Remove secret for Rails 7.2 so it will be generated automatically + # @see https://github.com/docker-library/redmine/issues/349#issuecomment-2516634932 + # REDMINE_SECRET_KEY_BASE: supersecretkey + REDMINE_PLUGINS_MIGRATE: true + volumes: + - ./.docker/redmine-60002_data/files:/usr/src/redmine/files + - ./.docker/redmine-60002_data/sqlite:/usr/src/redmine/sqlite + + strategy: + fail-fast: false + matrix: + operating-system: ["ubuntu-latest"] + php: ["8.3"] + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - name: Setup PHP, with composer and extensions + uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php + with: + php-version: ${{ matrix.php }} + tools: phpunit + extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite + coverage: xdebug + + # Install composer dependencies and handle caching in one go. + # @link https://github.com/marketplace/actions/install-composer-dependencies + - name: "Install Composer dependencies" + uses: "ramsey/composer-install@v2" + + - name: Run behat + run: vendor/bin/behat --config tests/Behat/behat.yml --suite=redmine_60002 + code-quality: name: Check ${{ matrix.tool }} (PHP ${{ matrix.php }}) runs-on: ubuntu-latest From 5824990bd8c438f0a1c643eae11715b772ce9de8 Mon Sep 17 00:00:00 2001 From: Art4 Date: Tue, 21 Jan 2025 10:09:09 +0100 Subject: [PATCH 11/24] Provide rootPath for behat via behat.yml --- tests/Behat/Bootstrap/FeatureContext.php | 4 +- tests/Behat/behat.yml | 3 + tests/RedmineExtension/BehatHookTracer.php | 4 +- tests/RedmineExtension/RedmineInstance.php | 71 ++++++++++++---------- 4 files changed, 45 insertions(+), 37 deletions(-) diff --git a/tests/Behat/Bootstrap/FeatureContext.php b/tests/Behat/Bootstrap/FeatureContext.php index 2dd5d193..b6e25fd9 100644 --- a/tests/Behat/Bootstrap/FeatureContext.php +++ b/tests/Behat/Bootstrap/FeatureContext.php @@ -81,7 +81,7 @@ public static function clean(AfterSuiteScope $scope) */ private array $lastReturnAsArray; - public function __construct(string $redmineVersion) + public function __construct(string $redmineVersion, string $rootPath) { $version = RedmineVersion::tryFrom($redmineVersion); @@ -89,7 +89,7 @@ public function __construct(string $redmineVersion) throw new InvalidArgumentException('Redmine ' . $redmineVersion . ' is not supported.'); } - $this->redmine = static::$tracer::getRedmineInstance($version); + $this->redmine = static::$tracer::getRedmineInstance($version, $rootPath); parent::__construct('BehatRedmine' . $version->asId()); } diff --git a/tests/Behat/behat.yml b/tests/Behat/behat.yml index f8b98022..c88d06f5 100644 --- a/tests/Behat/behat.yml +++ b/tests/Behat/behat.yml @@ -6,15 +6,18 @@ default: contexts: - Redmine\Tests\Behat\Bootstrap\FeatureContext: redmineVersion: '6.0.2' + rootPath: '%paths.base%/../../.docker' redmine_50105: paths: - '%paths.base%/features' contexts: - Redmine\Tests\Behat\Bootstrap\FeatureContext: redmineVersion: '5.1.5' + rootPath: '%paths.base%/../../.docker' redmine_50010: paths: - '%paths.base%/features' contexts: - Redmine\Tests\Behat\Bootstrap\FeatureContext: redmineVersion: '5.0.10' + rootPath: '%paths.base%/../../.docker' diff --git a/tests/RedmineExtension/BehatHookTracer.php b/tests/RedmineExtension/BehatHookTracer.php index bb916de1..04215442 100644 --- a/tests/RedmineExtension/BehatHookTracer.php +++ b/tests/RedmineExtension/BehatHookTracer.php @@ -22,14 +22,14 @@ final class BehatHookTracer implements InstanceRegistration */ private static array $instances = []; - public static function getRedmineInstance(RedmineVersion $redmineVersion): RedmineInstance + public static function getRedmineInstance(RedmineVersion $redmineVersion, string $rootPath): RedmineInstance { if (static::$tracer === null) { throw new RuntimeException('You can only get a Redmine instance while a Behat Suite is running.'); } if (! array_key_exists($redmineVersion->asId(), static::$instances)) { - RedmineInstance::create(static::$tracer, $redmineVersion); + RedmineInstance::create(static::$tracer, $redmineVersion, $rootPath); } return static::$instances[$redmineVersion->asId()]; diff --git a/tests/RedmineExtension/RedmineInstance.php b/tests/RedmineExtension/RedmineInstance.php index e4aa2a36..9957cc3c 100644 --- a/tests/RedmineExtension/RedmineInstance.php +++ b/tests/RedmineExtension/RedmineInstance.php @@ -14,16 +14,16 @@ final class RedmineInstance /** * @param InstanceRegistration $tracer Required to ensure that RedmineInstance is created while Test Runner is running */ - public static function create(InstanceRegistration $tracer, RedmineVersion $version): void + public static function create(InstanceRegistration $tracer, RedmineVersion $version, string $rootPath): void { - $tracer->registerInstance(new self($tracer, $version)); + $tracer->registerInstance(new self($tracer, $version, $rootPath)); } private InstanceRegistration $tracer; private RedmineVersion $version; - private string $rootPath; + private string $dataPath; private string $workingDB; @@ -41,14 +41,19 @@ public static function create(InstanceRegistration $tracer, RedmineVersion $vers private string $apiKey; - private function __construct(InstanceRegistration $tracer, RedmineVersion $version) + private function __construct(InstanceRegistration $tracer, RedmineVersion $version, string $rootPath) { $this->tracer = $tracer; $this->version = $version; $versionId = strval($version->asId()); - $this->rootPath = dirname(__FILE__, 3) . '/.docker/redmine-' . $versionId . '_data/'; + // Default to .docker folder + if ($rootPath === '') { + $rootPath = dirname(__FILE__, 3) . '/.docker'; + } + + $this->dataPath = $rootPath . '/redmine-' . $versionId . '_data/'; $this->workingDB = 'sqlite/redmine.db'; $this->migratedDB = 'sqlite/redmine-migrated.db'; @@ -108,10 +113,10 @@ private function runHealthChecks(RedmineVersion $version): void )); } - if (! file_exists($this->rootPath . $this->workingDB)) { + if (! file_exists($this->dataPath . $this->workingDB)) { throw new InvalidArgumentException(sprintf( 'Could not find database file in %s, please make sure that Redmine %s has a docker service in /docker-composer.yml and is correctly configured in /tests/Behat/behat.yml.', - $this->rootPath . $this->workingDB, + $this->dataPath . $this->workingDB, $version->asString(), )); } @@ -146,7 +151,7 @@ public function shutdown(InstanceRegistration $tracer): void */ public function excecuteDatabaseQuery(string $query, array $options = [], array $params = null): void { - $pdo = new PDO('sqlite:' . $this->rootPath . $this->workingDB); + $pdo = new PDO('sqlite:' . $this->dataPath . $this->workingDB); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $pdo->prepare($query, $options); @@ -156,7 +161,7 @@ public function excecuteDatabaseQuery(string $query, array $options = [], array private function runDatabaseMigration() { $now = new DateTimeImmutable(); - $pdo = new PDO('sqlite:' . $this->rootPath . $this->workingDB); + $pdo = new PDO('sqlite:' . $this->dataPath . $this->workingDB); // Get admin user to check sqlite connection $stmt = $pdo->prepare('SELECT * FROM users WHERE login = :login;'); @@ -191,9 +196,9 @@ private function runDatabaseMigration() */ private function createDatabaseBackup() { - $workingDB = new SQLite3($this->rootPath . $this->workingDB); + $workingDB = new SQLite3($this->dataPath . $this->workingDB); - $backupDB = new SQLite3($this->rootPath . $this->backupDB); + $backupDB = new SQLite3($this->dataPath . $this->backupDB); $workingDB->backup($backupDB); @@ -206,9 +211,9 @@ private function createDatabaseBackup() */ private function saveMigratedDatabase() { - $workingDB = new SQLite3($this->rootPath . $this->workingDB); + $workingDB = new SQLite3($this->dataPath . $this->workingDB); - $migratedDB = new SQLite3($this->rootPath . $this->migratedDB); + $migratedDB = new SQLite3($this->dataPath . $this->migratedDB); $workingDB->backup($migratedDB); @@ -218,9 +223,9 @@ private function saveMigratedDatabase() private function restoreFromMigratedDatabase(): void { - $workingDB = new SQLite3($this->rootPath . $this->workingDB); + $workingDB = new SQLite3($this->dataPath . $this->workingDB); - $migratedDB = new SQLite3($this->rootPath . $this->migratedDB); + $migratedDB = new SQLite3($this->dataPath . $this->migratedDB); $migratedDB->backup($workingDB); @@ -230,9 +235,9 @@ private function restoreFromMigratedDatabase(): void private function restoreDatabaseFromBackup(): void { - $workingDB = new SQLite3($this->rootPath . $this->workingDB); + $workingDB = new SQLite3($this->dataPath . $this->workingDB); - $backupDB = new SQLite3($this->rootPath . $this->backupDB); + $backupDB = new SQLite3($this->dataPath . $this->backupDB); $backupDB->backup($workingDB); @@ -242,18 +247,18 @@ private function restoreDatabaseFromBackup(): void private function removeDatabaseBackups(): void { - unlink($this->rootPath . $this->migratedDB); - unlink($this->rootPath . $this->backupDB); + unlink($this->dataPath . $this->migratedDB); + unlink($this->dataPath . $this->backupDB); } private function createFilesBackup() { // Add an empty file to avoid warnings about copying and removing content from an empty folder - touch($this->rootPath . $this->workingFiles . 'empty'); + touch($this->dataPath . $this->workingFiles . 'empty'); exec(sprintf( 'cp -r %s %s', - $this->rootPath . $this->workingFiles, - $this->rootPath . rtrim($this->backupFiles, '/'), + $this->dataPath . $this->workingFiles, + $this->dataPath . rtrim($this->backupFiles, '/'), )); } @@ -261,8 +266,8 @@ private function saveMigratedFiles() { exec(sprintf( 'cp -r %s %s', - $this->rootPath . $this->workingFiles, - $this->rootPath . rtrim($this->migratedFiles, '/'), + $this->dataPath . $this->workingFiles, + $this->dataPath . rtrim($this->migratedFiles, '/'), )); } @@ -270,13 +275,13 @@ private function restoreFromMigratedFiles(): void { exec(sprintf( 'rm -r %s', - $this->rootPath . $this->workingFiles . '*', + $this->dataPath . $this->workingFiles . '*', )); exec(sprintf( 'cp -r %s %s', - $this->rootPath . $this->migratedFiles . '*', - $this->rootPath . rtrim($this->workingFiles, '/'), + $this->dataPath . $this->migratedFiles . '*', + $this->dataPath . rtrim($this->workingFiles, '/'), )); } @@ -284,13 +289,13 @@ private function restoreFilesFromBackup(): void { exec(sprintf( 'rm -r %s', - $this->rootPath . $this->workingFiles . '*', + $this->dataPath . $this->workingFiles . '*', )); exec(sprintf( 'cp -r %s %s', - $this->rootPath . $this->backupFiles . '*', - $this->rootPath . rtrim($this->workingFiles, '/'), + $this->dataPath . $this->backupFiles . '*', + $this->dataPath . rtrim($this->workingFiles, '/'), )); } @@ -298,10 +303,10 @@ private function removeFilesBackups(): void { exec(sprintf( 'rm -r %s %s', - $this->rootPath . $this->migratedFiles, - $this->rootPath . $this->backupFiles, + $this->dataPath . $this->migratedFiles, + $this->dataPath . $this->backupFiles, )); - unlink($this->rootPath . $this->workingFiles . 'empty'); + unlink($this->dataPath . $this->workingFiles . 'empty'); } } From cc11fedc22fbc755bc3d2488d0deac3a0ed08b9e Mon Sep 17 00:00:00 2001 From: Art4 Date: Tue, 21 Jan 2025 10:28:29 +0100 Subject: [PATCH 12/24] Move feature paths into default settings --- tests/Behat/behat.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/Behat/behat.yml b/tests/Behat/behat.yml index c88d06f5..98e6c9f5 100644 --- a/tests/Behat/behat.yml +++ b/tests/Behat/behat.yml @@ -1,22 +1,19 @@ default: suites: - redmine_60002: + default: paths: - '%paths.base%/features' + redmine_60002: contexts: - Redmine\Tests\Behat\Bootstrap\FeatureContext: redmineVersion: '6.0.2' rootPath: '%paths.base%/../../.docker' redmine_50105: - paths: - - '%paths.base%/features' contexts: - Redmine\Tests\Behat\Bootstrap\FeatureContext: redmineVersion: '5.1.5' rootPath: '%paths.base%/../../.docker' redmine_50010: - paths: - - '%paths.base%/features' contexts: - Redmine\Tests\Behat\Bootstrap\FeatureContext: redmineVersion: '5.0.10' From c271face787f128a8d08b9a31a4158297ffda24f Mon Sep 17 00:00:00 2001 From: Art4 Date: Tue, 21 Jan 2025 10:35:22 +0100 Subject: [PATCH 13/24] define temp folder and behat profile for github actions --- .github/workflows/tests.yml | 2 +- tests/Behat/behat.yml | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 63c16a53..1cf5c840 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -81,7 +81,7 @@ jobs: uses: "ramsey/composer-install@v2" - name: Run behat - run: vendor/bin/behat --config tests/Behat/behat.yml --suite=redmine_60002 + run: vendor/bin/behat --config tests/Behat/behat.yml --profile=github-actions --suite=redmine_60002 code-quality: name: Check ${{ matrix.tool }} (PHP ${{ matrix.php }}) diff --git a/tests/Behat/behat.yml b/tests/Behat/behat.yml index 98e6c9f5..e39e1cea 100644 --- a/tests/Behat/behat.yml +++ b/tests/Behat/behat.yml @@ -18,3 +18,21 @@ default: - Redmine\Tests\Behat\Bootstrap\FeatureContext: redmineVersion: '5.0.10' rootPath: '%paths.base%/../../.docker' + +github-actions: + suites: + redmine_60002: + contexts: + - Redmine\Tests\Behat\Bootstrap\FeatureContext: + redmineVersion: '6.0.2' + rootPath: '%paths.base%/../../../.redmine-temp' + redmine_50105: + contexts: + - Redmine\Tests\Behat\Bootstrap\FeatureContext: + redmineVersion: '5.1.5' + rootPath: '%paths.base%/../../../.redmine-temp' + redmine_50010: + contexts: + - Redmine\Tests\Behat\Bootstrap\FeatureContext: + redmineVersion: '5.0.10' + rootPath: '%paths.base%/../../../.redmine-temp' From 47b31dd1888cd4fd0e5f5770c3d6022ab0805512 Mon Sep 17 00:00:00 2001 From: Art4 Date: Tue, 21 Jan 2025 10:39:35 +0100 Subject: [PATCH 14/24] Fix volumes in github actions tests --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1cf5c840..989090bc 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -52,8 +52,8 @@ jobs: # REDMINE_SECRET_KEY_BASE: supersecretkey REDMINE_PLUGINS_MIGRATE: true volumes: - - ./.docker/redmine-60002_data/files:/usr/src/redmine/files - - ./.docker/redmine-60002_data/sqlite:/usr/src/redmine/sqlite + - ../.redmine-temp/redmine-60002_data/files:/usr/src/redmine/files + - ../.redmine-temp/redmine-60002_data/sqlite:/usr/src/redmine/sqlite strategy: fail-fast: false From 25a11a075ff4fe6fad524de0ec0bee8a179e129e Mon Sep 17 00:00:00 2001 From: Art4 Date: Tue, 21 Jan 2025 10:43:21 +0100 Subject: [PATCH 15/24] Try absolute path to tmp folder for github actions --- .github/workflows/tests.yml | 4 ++-- tests/Behat/behat.yml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 989090bc..efc65bd9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -52,8 +52,8 @@ jobs: # REDMINE_SECRET_KEY_BASE: supersecretkey REDMINE_PLUGINS_MIGRATE: true volumes: - - ../.redmine-temp/redmine-60002_data/files:/usr/src/redmine/files - - ../.redmine-temp/redmine-60002_data/sqlite:/usr/src/redmine/sqlite + - /tmp/.redmine-temp/redmine-60002_data/files:/usr/src/redmine/files + - /tmp/.redmine-temp/redmine-60002_data/sqlite:/usr/src/redmine/sqlite strategy: fail-fast: false diff --git a/tests/Behat/behat.yml b/tests/Behat/behat.yml index e39e1cea..4375f192 100644 --- a/tests/Behat/behat.yml +++ b/tests/Behat/behat.yml @@ -25,14 +25,14 @@ github-actions: contexts: - Redmine\Tests\Behat\Bootstrap\FeatureContext: redmineVersion: '6.0.2' - rootPath: '%paths.base%/../../../.redmine-temp' + rootPath: '/tmp/.redmine-temp' redmine_50105: contexts: - Redmine\Tests\Behat\Bootstrap\FeatureContext: redmineVersion: '5.1.5' - rootPath: '%paths.base%/../../../.redmine-temp' + rootPath: '/tmp/.redmine-temp' redmine_50010: contexts: - Redmine\Tests\Behat\Bootstrap\FeatureContext: redmineVersion: '5.0.10' - rootPath: '%paths.base%/../../../.redmine-temp' + rootPath: '/tmp/.redmine-temp' From e626508c59e59a7e5760f8006bf7364aaea38599 Mon Sep 17 00:00:00 2001 From: Art4 Date: Tue, 21 Jan 2025 10:52:38 +0100 Subject: [PATCH 16/24] Add healt check --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index efc65bd9..f7c17757 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -54,6 +54,7 @@ jobs: volumes: - /tmp/.redmine-temp/redmine-60002_data/files:/usr/src/redmine/files - /tmp/.redmine-temp/redmine-60002_data/sqlite:/usr/src/redmine/sqlite + options: --health-cmd="wget -O /dev/null http://localhost:3000" --health-interval=30s --health-timeout=3s --health-retries=3 strategy: fail-fast: false From 2b6ee6d3c4653fb514dba6433b8530a00adde796 Mon Sep 17 00:00:00 2001 From: Art4 Date: Tue, 21 Jan 2025 13:02:48 +0100 Subject: [PATCH 17/24] increase healtcheck timeout --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f7c17757..b09c0f08 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -54,7 +54,7 @@ jobs: volumes: - /tmp/.redmine-temp/redmine-60002_data/files:/usr/src/redmine/files - /tmp/.redmine-temp/redmine-60002_data/sqlite:/usr/src/redmine/sqlite - options: --health-cmd="wget -O /dev/null http://localhost:3000" --health-interval=30s --health-timeout=3s --health-retries=3 + options: --health-cmd="wget -O /dev/null http://localhost:3000" --health-interval=30s --health-timeout=30s --health-retries=3 strategy: fail-fast: false From f60b6f099d1f6256751ffe3a23e3e917ab0a79be Mon Sep 17 00:00:00 2001 From: Art4 Date: Tue, 21 Jan 2025 13:07:30 +0100 Subject: [PATCH 18/24] Switch to /var/tmp --- .github/workflows/tests.yml | 4 ++-- tests/Behat/behat.yml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b09c0f08..f4a73d5b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -52,8 +52,8 @@ jobs: # REDMINE_SECRET_KEY_BASE: supersecretkey REDMINE_PLUGINS_MIGRATE: true volumes: - - /tmp/.redmine-temp/redmine-60002_data/files:/usr/src/redmine/files - - /tmp/.redmine-temp/redmine-60002_data/sqlite:/usr/src/redmine/sqlite + - /var/tmp/redmine-60002_data/files:/usr/src/redmine/files + - /var/tmp/redmine-60002_data/sqlite:/usr/src/redmine/sqlite options: --health-cmd="wget -O /dev/null http://localhost:3000" --health-interval=30s --health-timeout=30s --health-retries=3 strategy: diff --git a/tests/Behat/behat.yml b/tests/Behat/behat.yml index 4375f192..c9dbc3e8 100644 --- a/tests/Behat/behat.yml +++ b/tests/Behat/behat.yml @@ -25,14 +25,14 @@ github-actions: contexts: - Redmine\Tests\Behat\Bootstrap\FeatureContext: redmineVersion: '6.0.2' - rootPath: '/tmp/.redmine-temp' + rootPath: '/var/tmp' redmine_50105: contexts: - Redmine\Tests\Behat\Bootstrap\FeatureContext: redmineVersion: '5.1.5' - rootPath: '/tmp/.redmine-temp' + rootPath: '/var/tmp' redmine_50010: contexts: - Redmine\Tests\Behat\Bootstrap\FeatureContext: redmineVersion: '5.0.10' - rootPath: '/tmp/.redmine-temp' + rootPath: '/var/tmp' From f6d6664ba898e0acf49d7a6dc322c145b943b4c8 Mon Sep 17 00:00:00 2001 From: Art4 Date: Tue, 21 Jan 2025 14:07:28 +0100 Subject: [PATCH 19/24] Add --health-start-period --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f4a73d5b..3b115648 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -54,7 +54,7 @@ jobs: volumes: - /var/tmp/redmine-60002_data/files:/usr/src/redmine/files - /var/tmp/redmine-60002_data/sqlite:/usr/src/redmine/sqlite - options: --health-cmd="wget -O /dev/null http://localhost:3000" --health-interval=30s --health-timeout=30s --health-retries=3 + options: --health-cmd="wget -O /dev/null http://localhost:3000" --health-start-period=30s --health-interval=30s --health-timeout=30s --health-retries=3 strategy: fail-fast: false From f4e570a8904c0b8b08646d495bdb6b8f3158bb5d Mon Sep 17 00:00:00 2001 From: Art4 Date: Tue, 21 Jan 2025 14:14:51 +0100 Subject: [PATCH 20/24] Debug --- .github/workflows/tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3b115648..0d78e922 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -36,6 +36,8 @@ jobs: - name: Run tests run: vendor/bin/phpunit --no-coverage + - name: Debug + run: echo ${RUNNER_TEMP} behat: name: Tests (Behat with PHP ${{ matrix.php }}) From 9498493a670d12e454d1cf646a9440927217c78a Mon Sep 17 00:00:00 2001 From: Art4 Date: Tue, 21 Jan 2025 14:16:31 +0100 Subject: [PATCH 21/24] Change temp folder --- .github/workflows/tests.yml | 6 ++---- tests/Behat/behat.yml | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0d78e922..6a3260ee 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -36,8 +36,6 @@ jobs: - name: Run tests run: vendor/bin/phpunit --no-coverage - - name: Debug - run: echo ${RUNNER_TEMP} behat: name: Tests (Behat with PHP ${{ matrix.php }}) @@ -54,8 +52,8 @@ jobs: # REDMINE_SECRET_KEY_BASE: supersecretkey REDMINE_PLUGINS_MIGRATE: true volumes: - - /var/tmp/redmine-60002_data/files:/usr/src/redmine/files - - /var/tmp/redmine-60002_data/sqlite:/usr/src/redmine/sqlite + - /home/runner/work/_temp/redmine-60002_data/files:/usr/src/redmine/files + - /home/runner/work/_temp/redmine-60002_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: diff --git a/tests/Behat/behat.yml b/tests/Behat/behat.yml index c9dbc3e8..58834adf 100644 --- a/tests/Behat/behat.yml +++ b/tests/Behat/behat.yml @@ -25,14 +25,14 @@ github-actions: contexts: - Redmine\Tests\Behat\Bootstrap\FeatureContext: redmineVersion: '6.0.2' - rootPath: '/var/tmp' + rootPath: '/home/runner/work/_temp' redmine_50105: contexts: - Redmine\Tests\Behat\Bootstrap\FeatureContext: redmineVersion: '5.1.5' - rootPath: '/var/tmp' + rootPath: '/home/runner/work/_temp' redmine_50010: contexts: - Redmine\Tests\Behat\Bootstrap\FeatureContext: redmineVersion: '5.0.10' - rootPath: '/var/tmp' + rootPath: '/home/runner/work/_temp' From 639de570f8e92d468f4db4ef376bd824cee1e33c Mon Sep 17 00:00:00 2001 From: Art4 Date: Tue, 21 Jan 2025 14:19:00 +0100 Subject: [PATCH 22/24] Remove behat github action --- .github/workflows/tests.yml | 93 +++++++++++++++++++------------------ 1 file changed, 47 insertions(+), 46 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6a3260ee..6811a57f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -37,52 +37,53 @@ jobs: - name: Run tests run: vendor/bin/phpunit --no-coverage - behat: - name: Tests (Behat with PHP ${{ matrix.php }}) - runs-on: ubuntu-latest - - services: - redmine-60002: - image: redmine:6.0.2 - ports: - - "6002:3000" - env: - # Workaround: Remove secret for Rails 7.2 so it will be generated automatically - # @see https://github.com/docker-library/redmine/issues/349#issuecomment-2516634932 - # REDMINE_SECRET_KEY_BASE: supersecretkey - REDMINE_PLUGINS_MIGRATE: true - volumes: - - /home/runner/work/_temp/redmine-60002_data/files:/usr/src/redmine/files - - /home/runner/work/_temp/redmine-60002_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: - fail-fast: false - matrix: - operating-system: ["ubuntu-latest"] - php: ["8.3"] - - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 2 - - - name: Setup PHP, with composer and extensions - uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php - with: - php-version: ${{ matrix.php }} - tools: phpunit - extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite - coverage: xdebug - - # Install composer dependencies and handle caching in one go. - # @link https://github.com/marketplace/actions/install-composer-dependencies - - name: "Install Composer dependencies" - uses: "ramsey/composer-install@v2" - - - name: Run behat - run: vendor/bin/behat --config tests/Behat/behat.yml --profile=github-actions --suite=redmine_60002 + # This does not work + # behat: + # name: Tests (Behat with PHP ${{ matrix.php }}) + # runs-on: ubuntu-latest + + # services: + # redmine-60002: + # image: redmine:6.0.2 + # ports: + # - "6002:3000" + # env: + # # Workaround: Remove secret for Rails 7.2 so it will be generated automatically + # # @see https://github.com/docker-library/redmine/issues/349#issuecomment-2516634932 + # # REDMINE_SECRET_KEY_BASE: supersecretkey + # REDMINE_PLUGINS_MIGRATE: true + # volumes: + # - /home/runner/work/_temp/redmine-60002_data/files:/usr/src/redmine/files + # - /home/runner/work/_temp/redmine-60002_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: + # fail-fast: false + # matrix: + # operating-system: ["ubuntu-latest"] + # php: ["8.3"] + + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # with: + # fetch-depth: 2 + + # - name: Setup PHP, with composer and extensions + # uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php + # with: + # php-version: ${{ matrix.php }} + # tools: phpunit + # extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite + # coverage: xdebug + + # # Install composer dependencies and handle caching in one go. + # # @link https://github.com/marketplace/actions/install-composer-dependencies + # - name: "Install Composer dependencies" + # uses: "ramsey/composer-install@v2" + + # - name: Run behat + # run: vendor/bin/behat --config tests/Behat/behat.yml --profile=github-actions --suite=redmine_60002 code-quality: name: Check ${{ matrix.tool }} (PHP ${{ matrix.php }}) From db1641398a7a93a4d44443cb599612a5272d5bae Mon Sep 17 00:00:00 2001 From: Art4 Date: Tue, 21 Jan 2025 14:51:57 +0100 Subject: [PATCH 23/24] update php in docker file --- .docker/{PHP83-Dockerfile => PHP-Dockerfile} | 4 ++-- .github/workflows/tests.yml | 2 +- docker-compose.yml | 2 +- tests/RedmineExtension/RedmineInstance.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) rename .docker/{PHP83-Dockerfile => PHP-Dockerfile} (92%) diff --git a/.docker/PHP83-Dockerfile b/.docker/PHP-Dockerfile similarity index 92% rename from .docker/PHP83-Dockerfile rename to .docker/PHP-Dockerfile index 4b2ffa60..713f7e9c 100644 --- a/.docker/PHP83-Dockerfile +++ b/.docker/PHP-Dockerfile @@ -1,4 +1,4 @@ -FROM php:8.3.3-fpm +FROM php:8.3-fpm RUN apt-get update RUN apt-get --yes --no-install-recommends install \ @@ -32,7 +32,7 @@ RUN docker-php-ext-install -j$(nproc) \ COPY build/php/opcache.ini /usr/local/etc/php/conf.d/ COPY build/php/custom.ini /usr/local/etc/php/conf.d/ -RUN pecl install xdebug-3.3.1 && docker-php-ext-enable xdebug +RUN pecl install xdebug-3.4.0 && docker-php-ext-enable xdebug RUN php --version diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6811a57f..88a2f002 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,7 +13,7 @@ jobs: fail-fast: false matrix: operating-system: ["ubuntu-latest"] - php: ["7.4", "8.0", "8.1", "8.2", "8.3", "8.4"] + php: ["7.4", "8.0", "8.1", "8.2", "8.3", "8.4", "8.5"] steps: - name: Checkout diff --git a/docker-compose.yml b/docker-compose.yml index b30adf57..356a582c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ services: php: build: # Info to build the Docker image context: ./.docker # Specify where the Dockerfile is located (e.g. in the root directory of the project) - dockerfile: PHP83-Dockerfile # Specify the name of the Dockerfile + dockerfile: PHP-Dockerfile # Specify the name of the Dockerfile ports: - 8111:80 depends_on: diff --git a/tests/RedmineExtension/RedmineInstance.php b/tests/RedmineExtension/RedmineInstance.php index 9957cc3c..547917b7 100644 --- a/tests/RedmineExtension/RedmineInstance.php +++ b/tests/RedmineExtension/RedmineInstance.php @@ -149,7 +149,7 @@ public function shutdown(InstanceRegistration $tracer): void /** * Allows tests to prepare the database */ - public function excecuteDatabaseQuery(string $query, array $options = [], array $params = null): void + public function excecuteDatabaseQuery(string $query, array $options = [], ?array $params = null): void { $pdo = new PDO('sqlite:' . $this->dataPath . $this->workingDB); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); From 8ebb5299b7f16ec9f377103eac42d81838b7c4da Mon Sep 17 00:00:00 2001 From: Art4 Date: Tue, 21 Jan 2025 14:55:44 +0100 Subject: [PATCH 24/24] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c6ea43c..89d63116 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- Added support for PHP 8.4 - Support for Redmine 6.0.x was added. - New class `Redmine\Http\HttpFactory` to create `Redmine\Http\Request` and `Redmine\Http\Response` instances.