Skip to content

Commit

Permalink
Merge pull request #438 from kbsali/437-update-the-behat-tests-redmin…
Browse files Browse the repository at this point in the history
…e-602-and-515-released

Add support for Redmine 6.0.2
  • Loading branch information
Art4 authored Jan 21, 2025
2 parents 355a0b2 + 8ebb529 commit 2bcffdd
Show file tree
Hide file tree
Showing 17 changed files with 277 additions and 113 deletions.
4 changes: 2 additions & 2 deletions .docker/PHP83-Dockerfile → .docker/PHP-Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand Down Expand Up @@ -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

Expand Down
50 changes: 49 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -37,6 +37,54 @@ jobs:
- name: Run tests
run: vendor/bin/phpunit --no-coverage

# 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 }})
runs-on: ubuntu-latest
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ 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.

### 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

Expand All @@ -25,6 +27,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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ 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
- 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.
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_50104",
"@behat --format=progress --suite=redmine_50010",
"@behat --format=progress --suite=redmine_40210"
"@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",
"codestyle": "php-cs-fixer fix",
Expand Down
46 changes: 23 additions & 23 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -11,12 +11,13 @@ 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:
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
Expand All @@ -25,40 +26,39 @@ services:
# Make sure the following services are configured in:
# - /tests/Behat/behat.yml

redmine-50104:
image: redmine:5.1.4
user: "1000:1000"
redmine-60002:
image: redmine:6.0.2
ports:
- "5103:3000"
- "6002: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-50104_data/files:/usr/src/redmine/files
- ./.docker/redmine-50104_data/sqlite:/usr/src/redmine/sqlite
- ./.docker/redmine-60002_data/files:/usr/src/redmine/files
- ./.docker/redmine-60002_data/sqlite:/usr/src/redmine/sqlite

redmine-50010:
image: redmine:5.0.10
redmine-50105:
image: redmine:5.1.5
user: "1000:1000"
ports:
- "5009:3000"
- "5105:3000"
environment:
REDMINE_SECRET_KEY_BASE: supersecretkey
REDMINE_PLUGINS_MIGRATE: true
volumes:
- ./.docker/redmine-50010_data/files:/usr/src/redmine/files
- ./.docker/redmine-50010_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-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
redmine-50010:
image: redmine:5.0.10
user: "1000:1000"
ports:
- "4210:3000"
- "5010: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
- ./.docker/redmine-50010_data/files:/usr/src/redmine/files
- ./.docker/redmine-50010_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 @@ -81,15 +81,15 @@ 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);

if ($version === null) {
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());
}
Expand Down
36 changes: 26 additions & 10 deletions tests/Behat/behat.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,38 @@
default:
suites:
redmine_50104:
default:
paths:
- '%paths.base%/features'
redmine_60002:
contexts:
- Redmine\Tests\Behat\Bootstrap\FeatureContext:
redmineVersion: '5.1.4'
redmineVersion: '6.0.2'
rootPath: '%paths.base%/../../.docker'
redmine_50105:
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'
redmine_40210:
paths:
- '%paths.base%/features'
rootPath: '%paths.base%/../../.docker'

github-actions:
suites:
redmine_60002:
contexts:
- Redmine\Tests\Behat\Bootstrap\FeatureContext:
redmineVersion: '4.2.10'
filters:
tags: "~@since50000"
redmineVersion: '6.0.2'
rootPath: '/home/runner/work/_temp'
redmine_50105:
contexts:
- Redmine\Tests\Behat\Bootstrap\FeatureContext:
redmineVersion: '5.1.5'
rootPath: '/home/runner/work/_temp'
redmine_50010:
contexts:
- Redmine\Tests\Behat\Bootstrap\FeatureContext:
redmineVersion: '5.0.10'
rootPath: '/home/runner/work/_temp'
1 change: 0 additions & 1 deletion tests/Behat/features/attachments.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
13 changes: 2 additions & 11 deletions tests/Behat/features/issue.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions tests/Behat/features/projects.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand Down
9 changes: 1 addition & 8 deletions tests/Behat/features/tracker.feature
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,14 @@ 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
default_status
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 |
Expand Down
Loading

0 comments on commit 2bcffdd

Please sign in to comment.