From ef11e2e5014b75ba5ac66ff2c643ab98bf8b70a5 Mon Sep 17 00:00:00 2001 From: Daniel Gohlke Date: Thu, 26 Mar 2026 20:41:02 +0100 Subject: [PATCH] [TASK] Add PHP 8.5 support Relates: #76 --- .github/workflows/ci.yaml | 27 +++- .gitlab-ci.yml | 151 ------------------ Classes/Domain/Model/Book.php | 4 +- .../CheckProductAvailability.php | 8 +- Tests/Unit/Domain/Model/BookTest.php | 1 - composer.json | 4 +- shell.nix | 2 - 7 files changed, 32 insertions(+), 165 deletions(-) delete mode 100644 .gitlab-ci.yml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 94ff1a2..7b3a952 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -17,6 +17,8 @@ jobs: php-version: - 8.2 - 8.3 + - 8.4 + - 8.5 steps: - name: Checkout uses: actions/checkout@v4 @@ -59,6 +61,7 @@ jobs: - php-version: '8.2' - php-version: '8.3' - php-version: '8.4' + - php-version: '8.5' steps: - uses: actions/checkout@v4 @@ -77,15 +80,15 @@ jobs: - name: Code Quality (by PHPStan) run: vendor/bin/phpstan analyse -c Build/phpstan.neon - tests-acceptance: + test-unit-and-functional: runs-on: ubuntu-latest needs: - coding-guideline - code-quality steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v5 - - uses: cachix/install-nix-action@v17 + - uses: cachix/install-nix-action@v31 with: nix_path: nixpkgs=channel:nixos-unstable @@ -98,6 +101,20 @@ jobs: - name: Run Unit Tests PHP8.4 run: nix-shell --arg phpVersion \"php84\" --pure --run project-test-unit + - name: Run Unit Tests PHP8.5 + run: nix-shell --arg phpVersion \"php85\" --pure --run project-test-unit + + test-acceptance: + runs-on: ubuntu-latest + needs: + - test-unit-and-functional + steps: + - uses: actions/checkout@v5 + + - uses: cachix/install-nix-action@v31 + with: + nix_path: nixpkgs=channel:nixos-unstable + - name: Run Acceptance Tests PHP8.2 run: nix-shell --arg phpVersion \"php82\" --pure --run project-test-acceptance @@ -106,3 +123,7 @@ jobs: - name: Run Acceptance Tests PHP8.4 run: nix-shell --arg phpVersion \"php84\" --pure --run project-test-acceptance + + - name: Run Acceptance Tests PHP8.5 + run: nix-shell --arg phpVersion \"php85\" --pure --run project-test-acceptance + diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 1615f3e..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,151 +0,0 @@ -cache: - key: "$CI_JOB_STAGE-$CI_COMMIT_REF_NAME" - paths: - - .composer/ - - .php_cs.cache - -variables: - COMPOSER_CACHE_DIR: ".composer" - TYPO3_PATH_WEB: "$CI_PROJECT_DIR/.build/public" - MYSQL_DATABASE: "typo3" - MYSQL_ROOT_PASSWORD: "joh316" - typo3DatabaseName: "typo3" - typo3DatabaseHost: "mysql" - typo3DatabaseUsername: "root" - typo3DatabasePassword: "joh316" - -before_script: - - apk add git --update - -stages: - - lint - - test - - documentation - -lint:cgl: - image: $CI_REGISTRY/containers/phpunit-with-php-8.2:main - stage: lint - before_script: - - composer remove typo3/cms-* --no-update - - composer install --no-progress --no-ansi --no-interaction - script: - - vendor/bin/php-cs-fixer fix --config=Build/.php-cs-fixer.dist.php -v --dry-run --using-cache=no --path-mode=intersection ./ - - vendor/bin/typoscript-lint -c Build/typoscriptlint.yaml Configuration - -lint:yaml: - stage: lint - image: python:alpine3.7 - before_script: - - pip install yamllint==1.10.0 - script: - - yamllint -c Build/yamllint.yaml Configuration/ Resources/ - -.lint_php: &lint_php - stage: lint - image: $CONTAINER_IMAGE - script: - - find *.php Classes Configuration Tests -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l - -lint:php82: - <<: *lint_php - variables: - CONTAINER_IMAGE: php:8.2-alpine - -lint:php83: - <<: *lint_php - variables: - CONTAINER_IMAGE: php:8.3-alpine - -phpstan:analyse: - image: $CI_REGISTRY/containers/phpunit-with-php-8.2:main - stage: lint - before_script: - - composer install --no-progress --no-ansi --no-interaction - script: - - vendor/bin/phpstan analyse -c Build/phpstan.neon --memory-limit 256M - -.test_php: &test_php - stage: test - services: - - mysql:5 - image: $CONTAINER_IMAGE - only: - - branches - before_script: - - composer install --no-progress --no-ansi --no-interaction - script: - - vendor/bin/phpunit -c Build/UnitTests.xml - -test:phpunit.php82: - <<: *test_php - variables: - CONTAINER_IMAGE: $CI_REGISTRY/containers/phpunit-with-php-8.2:main - -test:phpunit.php83: - <<: *test_php - variables: - CONTAINER_IMAGE: $CI_REGISTRY/containers/phpunit-with-php-8.3:main - -test:phpunit.php84: - <<: *test_php - variables: - CONTAINER_IMAGE: $CI_REGISTRY/containers/phpunit-with-php-8.4:main - -.test_codeception: &test_codeception - stage: test - image: $CONTAINER_IMAGE - only: - - branches - before_script: - - composer install --no-progress --no-ansi --no-interaction - script: - - mkdir -p .build/public/typo3temp/var/tests/acceptance-sqlite-dbs - - export typo3DatabaseDriver=pdo_sqlite - - export PROJECT_ROOT="$(pwd)" - - export INSTANCE_PATH="$(pwd)/.build/web/typo3temp/var/tests/acceptance" - - mkdir -p "$INSTANCE_PATH" - - mkdir -p "$PROJECT_ROOT/.build/web/typo3temp/var/tests/acceptance-logs/" - - vendor/bin/codecept build - - vendor/bin/codecept run - artifacts: - paths: - - .build - expire_in: 1 day - when: always - -test:codeception:php82: - <<: *test_codeception - variables: - CONTAINER_IMAGE: $CI_REGISTRY/containers/codeception-with-php-8.2:main - GECKODRIVER_VERSION: v0.34.0 - -test:codeception:php83: - <<: *test_codeception - needs: - - test:codeception:php82 - variables: - CONTAINER_IMAGE: $CI_REGISTRY/containers/codeception-with-php-8.3:main - GECKODRIVER_VERSION: v0.34.0 - -test:codeception:php84: - <<: *test_codeception - needs: - - test:codeception:php83 - variables: - CONTAINER_IMAGE: $CI_REGISTRY/containers/codeception-with-php-8.4:main - GECKODRIVER_VERSION: v0.34.0 - -documentation: - stage: documentation - image: - name: ghcr.io/typo3-documentation/render-guides:latest - entrypoint: [ "" ] - script: - - mkdir -p Documentation-GENERATED-temp - - /opt/guides/entrypoint.sh --config=Documentation --no-progress --fail-on-log - before_script: [] - artifacts: - paths: - - Documentation-GENERATED-temp/ - expire_in: 1 day - when: always diff --git a/Classes/Domain/Model/Book.php b/Classes/Domain/Model/Book.php index 57476be..152b6aa 100644 --- a/Classes/Domain/Model/Book.php +++ b/Classes/Domain/Model/Book.php @@ -84,8 +84,8 @@ public function getBestSpecialPrice(array $frontendUserGroupIds = []): float foreach ($this->getSpecialPrices() as $specialPrice) { if ($specialPrice->getPrice() < $bestSpecialPrice) { - if (!$specialPrice->getFrontendUserGroup() || - in_array($specialPrice->getFrontendUserGroup()->getUid(), $frontendUserGroupIds) + if (!$specialPrice->getFrontendUserGroup() + || in_array($specialPrice->getFrontendUserGroup()->getUid(), $frontendUserGroupIds) ) { $bestSpecialPrice = $specialPrice->getPrice(); } diff --git a/Classes/EventListener/CheckProductAvailability.php b/Classes/EventListener/CheckProductAvailability.php index 53036fb..09b9b8a 100644 --- a/Classes/EventListener/CheckProductAvailability.php +++ b/Classes/EventListener/CheckProductAvailability.php @@ -47,10 +47,10 @@ public function __invoke(CheckProductAvailabilityEvent $event): void $book = $this->bookRepository->findByIdentifier($cartProduct->getProductId()); if ( - !$book instanceof Book || - ( - $book->isHandleStock() && - ($quantity > $book->getStock()) + !$book instanceof Book + || ( + $book->isHandleStock() + && ($quantity > $book->getStock()) ) ) { $event->setAvailable(false); diff --git a/Tests/Unit/Domain/Model/BookTest.php b/Tests/Unit/Domain/Model/BookTest.php index 2287d17..9a56cdc 100644 --- a/Tests/Unit/Domain/Model/BookTest.php +++ b/Tests/Unit/Domain/Model/BookTest.php @@ -87,7 +87,6 @@ public function getTaxClassIdReturnsValueForTaxClassId(): void private function setProperty(object $instance, string $propertyName, mixed $propertyValue) { $reflection = new \ReflectionProperty($instance, $propertyName); - $reflection->setAccessible(true); $reflection->setValue($instance, $propertyValue); } } diff --git a/composer.json b/composer.json index b375566..e1920e1 100644 --- a/composer.json +++ b/composer.json @@ -45,7 +45,7 @@ } }, "require": { - "php": "~8.2.0 || ~8.3.0 || ~8.4.0", + "php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0", "ext-json": "*", "ext-pdo": "*", "extcode/cart": "^11.0", @@ -55,7 +55,7 @@ "typo3/cms-fluid": "^13.4" }, "require-dev": { - "codappix/typo3-php-datasets": "^1.5", + "codappix/typo3-php-datasets": "^2.1", "codeception/codeception": "^5.0", "codeception/module-db": "^3.1", "codeception/module-webdriver": "^4.0", diff --git a/shell.nix b/shell.nix index 237c90d..2e57aca 100644 --- a/shell.nix +++ b/shell.nix @@ -156,8 +156,6 @@ in pkgs.mkShell { packages = [ pkgs.gnumake pkgs.busybox ]; shellHook = '' - export TMPDIR=$HOME/.cache/development/cart_books - export PROJECT_ROOT="$(pwd)" export typo3DatabaseDriver=pdo_sqlite