Skip to content

Commit

Permalink
Upgrade PHPUnit and add PHP 8.4 to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-schranz committed Jul 24, 2024
1 parent f5db9a5 commit 64031e3
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 24 deletions.
31 changes: 23 additions & 8 deletions .github/workflows/test-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
database: postgres
dependency-versions: 'lowest'
tools: 'composer:v2'
phpunit-config: 'phpunit-9.xml.dist'
env:
SYMFONY_DEPRECATIONS_HELPER: disabled
DATABASE_URL: postgres://postgres:postgres@127.0.0.1/sulu_form_test?serverVersion=12.5
Expand All @@ -30,6 +31,7 @@ jobs:
database: mysql
dependency-versions: 'highest'
tools: 'composer:v2'
phpunit-config: 'phpunit-9.xml.dist'
env:
SYMFONY_DEPRECATIONS_HELPER: weak
DATABASE_URL: mysql://root:root@127.0.0.1/sulu_form_test?serverVersion=5.7
Expand Down Expand Up @@ -57,6 +59,16 @@ jobs:
DATABASE_COLLATE: utf8mb4_unicode_ci

- php-version: '8.2'
database: postgres
dependency-versions: 'highest'
tools: 'composer:v2'
env:
SYMFONY_DEPRECATIONS_HELPER: weak
DATABASE_URL: postgres://postgres:postgres@127.0.0.1/sulu_form_test?serverVersion=12.5
DATABASE_CHARSET: UTF8
DATABASE_COLLATE:

- php-version: '8.3'
database: mysql
dependency-versions: 'highest'
tools: 'composer:v2'
Expand All @@ -66,10 +78,11 @@ jobs:
DATABASE_CHARSET: utf8mb4
DATABASE_COLLATE: utf8mb4_unicode_ci

- php-version: '8.3'
- php-version: '8.4'
database: mysql
dependency-versions: 'highest'
tools: 'composer:v2'
composer-options: '--ignore-platform-reqs'
env:
SYMFONY_DEPRECATIONS_HELPER: weak
DATABASE_URL: mysql://root:root@127.0.0.1/sulu_form_test?serverVersion=5.7
Expand All @@ -96,7 +109,7 @@ jobs:

steps:
- name: Checkout project
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install and configure PHP
uses: shivammathur/setup-php@v2
Expand All @@ -106,11 +119,13 @@ jobs:
tools: ${{ matrix.tools }}
coverage: none

- name: Remove not required tooling for tests
run: composer remove php-cs-fixer/shim "*phpstan*" --dev --no-update
- 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@v1
uses: ramsey/composer-install@v2
with:
dependency-versions: ${{matrix.dependency-versions}}
composer-options: ${{ matrix.composer-options }}
Expand All @@ -120,7 +135,7 @@ jobs:
env: ${{ matrix.env }}

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

lint:
Expand All @@ -131,7 +146,7 @@ jobs:

steps:
- name: Checkout project
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install and configure PHP
uses: shivammathur/setup-php@v2
Expand All @@ -142,7 +157,7 @@ jobs:
coverage: none

- name: Install composer dependencies
uses: ramsey/composer-install@v1
uses: ramsey/composer-install@v2
with:
dependency-versions: ${{matrix.dependency-versions}}
composer-options: ${{ matrix.composer-options }}
Expand Down
2 changes: 0 additions & 2 deletions Tests/Functional/Mail/HelperTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ class HelperTestCase extends SuluTestCase

protected function setUp(): void
{
static::$kernel = null; // requires as Symfony 4.4 does not unset on tearDown

$this->client = $this->createWebsiteClient();
$this->purgeDatabase();
$this->initPhpcr();
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"phpstan/phpstan-doctrine": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpstan/phpstan-symfony": "^1.0",
"phpunit/phpunit": "^8.0",
"phpunit/phpunit": "^9.6 || ^10.0",
"sendinblue/api-v3-sdk": "^8.0",
"symfony/browser-kit": "^4.4 || ^5.0 || ^6.0 || ^7.0",
"symfony/dotenv": "^4.4 || ^5.0 || ^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/test-bootstrap.php">
<testsuites>
<testsuite name="Sulu Form 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\FormBundle\Tests\Application\Kernel"/>
<env name="APP_ENV" value="test" force="true"/>
</php>
</phpunit>
25 changes: 12 additions & 13 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true" bootstrap="Tests/test-bootstrap.php">
<testsuites>
<testsuites>
<testsuite name="Sulu Form 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\FormBundle\Tests\Application\Kernel"/>
<env name="APP_ENV" value="test" force="true"/>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak"/>
</php>

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

0 comments on commit 64031e3

Please sign in to comment.