Skip to content

Commit

Permalink
Upgrade PHPUnit and add PHP 8.4 to CI (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-schranz authored Jul 24, 2024
1 parent a884fb2 commit a7ebc3a
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 16 deletions.
18 changes: 15 additions & 3 deletions .github/workflows/test-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ jobs:
- php-version: '7.2'
dependency-versions: 'lowest'
tools: 'composer:v2'
phpunit-config: 'phpunit-9.xml.dist'
env:
SYMFONY_DEPRECATIONS_HELPER: disabled

- php-version: '7.4'
dependency-versions: 'highest'
tools: 'composer:v2'
phpunit-config: 'phpunit-9.xml.dist'
env:
SYMFONY_DEPRECATIONS_HELPER: disabled

Expand Down Expand Up @@ -55,6 +57,13 @@ jobs:
env:
SYMFONY_DEPRECATIONS_HELPER: weak

- php-version: '8.4'
dependency-versions: 'highest'
tools: 'composer:v2'
composer-options: '--ignore-platform-reqs'
env:
SYMFONY_DEPRECATIONS_HELPER: weak

services:
mysql:
image: mysql:5.7
Expand All @@ -79,20 +88,23 @@ jobs:
if: ${{ matrix.php-version == '7.2' }}
run: composer remove phpspec/prophecy-phpunit --no-update --dev

- name: Remove not required test tooling
run: composer remove "*php-cs-fixer*" "*phpstan*" --no-update --dev
- name: Remove Lint Tools
# These tools are not required to run tests, so we are removing them to improve dependency resolving and
# testing lowest versions.
run: composer remove "*php-cs-fixer*" "*phpstan*" "*rector*" --dev --no-update

- name: Install composer dependencies
uses: ramsey/composer-install@v2
with:
dependency-versions: ${{matrix.dependency-versions}}
composer-options: ${{ matrix.composer-options }}

- name: Bootstrap test environment
run: composer bootstrap-test-environment
env: ${{ matrix.env }}

- name: Execute test cases
run: composer test
run: composer test -- --config ${{ matrix.phpunit-config || 'phpunit.xml.dist' }}
env: ${{ matrix.env }}

lint:
Expand Down
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"license": "MIT",
"require": {
"php": "^7.2 || ^8.0",
"doctrine/collections": "^1.0 || ^2.0",
"doctrine/orm": "^2.5.3",
"doctrine/persistence": "^1.3.0 || ^2.0 || ^3.0",
"friendsofsymfony/rest-bundle": "^2.6 || ^3.0",
"sulu/sulu": "^2.4 || ^2.5@dev",
"symfony/config": "^4.4 || ^5.4 || ^6.0 || ^7.0",
Expand All @@ -27,7 +30,7 @@
"phpstan/phpstan-doctrine": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpstan/phpstan-symfony": "^1.0",
"phpunit/phpunit": "^8.0 ||^9.6",
"phpunit/phpunit": "^8.0 || ^9.6.20 || ^10.0",
"symfony/browser-kit": "^4.4 || ^5.4 || ^6.0 || ^7.0",
"symfony/dotenv": "^4.4 || ^5.4 || ^6.0 || ^7.0",
"symfony/form": "^4.4 || ^5.4 || ^6.0 || ^7.0",
Expand Down
24 changes: 24 additions & 0 deletions phpunit-9.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true" bootstrap="Tests/bootstrap.php">
<testsuites>
<testsuite name="Sulu Comment Bundle">
<directory>./Tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory>.</directory>
<exclude>
<directory>Resources/</directory>
<directory>Tests/</directory>
<directory>vendor/</directory>
</exclude>
</whitelist>
</filter>

<php>
<env name="KERNEL_CLASS" value="Sulu\Bundle\CommentBundle\Tests\Application\Kernel"/>
<env name="APP_ENV" value="test" force="true"/>
</php>
</phpunit>
24 changes: 12 additions & 12 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true" bootstrap="Tests/bootstrap.php">
<testsuites>
<testsuites>
<testsuite name="Sulu Comment Bundle">
<directory>./Tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory>.</directory>
<exclude>
<directory>Resources/</directory>
<directory>Tests/</directory>
<directory>vendor/</directory>
</exclude>
</whitelist>
</filter>

<php>
<env name="KERNEL_CLASS" value="Sulu\Bundle\CommentBundle\Tests\Application\Kernel"/>
</php>

<source>
<include>
<directory>./</directory>
</include>
<exclude>
<directory>Resources/</directory>
<directory>Tests/</directory>
<directory>vendor/</directory>
</exclude>
</source>
</phpunit>

0 comments on commit a7ebc3a

Please sign in to comment.