From 205e92ab809027008eff4f2a285cbed75fd57bf7 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Thu, 28 Oct 2021 15:15:28 +0200 Subject: [PATCH 1/2] GH Actions: set error reporting to E_ALL The default setting for `error_reporting` used by the SetupPHP action is `error_reporting=E_ALL & ~E_DEPRECATED & ~E_STRICT` and `display_errors` is set to `Off`. For the purposes of CI, I'd recommend running with `E_ALL` and `display_errors=On` to ensure **all** PHP notices are shown. --- .github/workflows/continuous-integration.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index e56dd68f..067accd4 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -22,7 +22,7 @@ jobs: with: php-version: "7.4" coverage: "none" - ini-values: "memory_limit=-1" + ini-values: "memory_limit=-1, zend.assertions=1, error_reporting=-1, display_errors=On" tools: "composer:v2" - uses: "ramsey/composer-install@v1" - name: "Lint the PHP source code" @@ -70,7 +70,7 @@ jobs: with: php-version: "${{ matrix.php-version }}" coverage: "pcov" - ini-values: "memory_limit=-1" + ini-values: "memory_limit=-1, zend.assertions=1, error_reporting=-1, display_errors=On" tools: "composer:v2" - name: "Prepare for tests" run: "mkdir -p build/logs" From b990cfd92c29404c79ca222cd8cfa6fcec7bf70f Mon Sep 17 00:00:00 2001 From: jrfnl Date: Thu, 28 Oct 2021 15:35:45 +0200 Subject: [PATCH 2/2] PHPUnit: update configuration PHPUnit recently released version 9.5.10 and 8.5.21. This contains a particular (IMO breaking) change: > * PHPUnit no longer converts PHP deprecations to exceptions by default (configure `convertDeprecationsToExceptions="true"` to enable this) Let's unpack this: Previously (PHPUnit < 9.5.10/8.5.21), if PHPUnit would encounter a PHP native deprecation notice, it would: 1. Show a test which causes a deprecation notice to be thrown as **"errored"**, 2. Show the **first** deprecation notice it encountered and 3. PHPUnit would exit with a **non-0 exit code** (2), which will fail a CI build. As of PHPUnit 9.5.10/8.5.21, if PHPUnit encounters a PHP native deprecation notice, it will no longer do so. Instead PHPUnit will: 1. Show a test which causes a PHP deprecation notice to be thrown as **"risky"**, 2. Show the **all** deprecation notices it encountered and 3. PHPUnit will exit with a **0 exit code**, which will show a CI build as passing. This commit reverts PHPUnit to the previous behaviour by adding `convertDeprecationsToExceptions="true"` to the PHPUnit configuration. It also adds the other related directives for consistency. Refs: * https://github.com/sebastianbergmann/phpunit/blob/9.5/ChangeLog-8.5.md * https://github.com/sebastianbergmann/phpunit/blob/9.5/ChangeLog-9.5.md --- phpunit.xml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/phpunit.xml b/phpunit.xml index bf749bfb..46accb38 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,5 +1,12 @@ - + ./test