From abbd5ae8e17c53f6401d0fff8bb824cc0a0b879e Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Thu, 20 Jan 2022 14:46:11 +0200 Subject: [PATCH 01/20] Upgrade to willdurand/negotiation 3.0.x which supports PHP 8 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 2f1f9d3e5..9a73d1313 100644 --- a/composer.json +++ b/composer.json @@ -65,7 +65,7 @@ "twig/extensions": "1.5.*", "twitter/bootstrap": "3.3.*", "twitter/typeahead.js": "v0.10.5", - "willdurand/negotiation": "2.3.*", + "willdurand/negotiation": "3.0.*", "vakata/jstree": "3.3.*", "punic/punic": "3.5.1", "ml/json-ld": "1.*", From a1b3f19384724e1f2d2d08f264bf59361c0a287b Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Thu, 20 Jan 2022 14:47:19 +0200 Subject: [PATCH 02/20] Reenable PHP 8.0 CI jobs (not experimental anymore - let's see if it works!) --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 076fbe66f..2d9bbb0fa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: false matrix: - php_version: [7.2, 7.3, 7.4] + php_version: [7.2, 7.3, 7.4, 8.0] experimental: [false] steps: From 7283ff26ca9376008f07a93e0005ca6b7d21f056 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Thu, 20 Jan 2022 15:10:43 +0200 Subject: [PATCH 03/20] upgrade to php-actions/phpunit v3 to see if it helps diagnosing hanging PHP 8.0 CI jobs --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2d9bbb0fa..c3206b1a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,7 +43,7 @@ jobs: php_extensions: gettext intl xsl pcov - name: Run PHPUnit tests - uses: php-actions/phpunit@91ff02a58932e63741157ea8c04e7e7077233537 + uses: php-actions/phpunit@v3 env: LANGUAGE: fr with: From 62dd0a19388fe767194682ba29a5028c1138945d Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Fri, 21 Jan 2022 09:28:05 +0200 Subject: [PATCH 04/20] set a 10 minute timeout on the CI action (instead of default 6 hours) --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c3206b1a2..f60f15dbb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,7 @@ on: [push] jobs: build-test: runs-on: ubuntu-latest + timeout-minutes: 10 continue-on-error: ${{ matrix.experimental }} strategy: fail-fast: false From cbd860d60e96ad6a0ed52da7474dfb1a54e3c6a3 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Fri, 21 Jan 2022 09:34:42 +0200 Subject: [PATCH 05/20] enable verbose & debug output for PHPUnit --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f60f15dbb..2dc143d27 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,6 +52,7 @@ jobs: php_version: ${{ matrix.php_version }} php_extensions: gettext intl xsl pcov memory_limit: 512M + args: --verbose --debug - name: Publish code coverage to Code Climate uses: paambaati/codeclimate-action@v2.7.5 From 5dc322df8ebc89ed853d900d5bec358ec69e0fda Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Fri, 21 Jan 2022 10:17:01 +0200 Subject: [PATCH 06/20] skip Http304 tests that seem to be getting stuck under GitHub Actions CI --- tests/Http304Test.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/Http304Test.php b/tests/Http304Test.php index cbeafe1b0..108d480ee 100644 --- a/tests/Http304Test.php +++ b/tests/Http304Test.php @@ -26,6 +26,13 @@ class Http304Test extends TestCase */ private $twig; + /* skip these tests for now, to diagnose PHP 8 issues */ + protected function setUp() : void + { + $this->markTestSkipped(); + } + + /** * Initializes the test objects. Not using setUp here as the $vocabularyName * needs to be specified per test. From 85d03929d8d4218b691131a40213969d24d983a6 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Fri, 21 Jan 2022 10:37:56 +0200 Subject: [PATCH 07/20] set path to phpunit.xml under GitHub Actions CI --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2dc143d27..3b1f88e56 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,6 +52,7 @@ jobs: php_version: ${{ matrix.php_version }} php_extensions: gettext intl xsl pcov memory_limit: 512M + configuration: phpunit.xml args: --verbose --debug - name: Publish code coverage to Code Climate From 2fdcbcca2aeca636b16c64606dbad8d72568d633 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Fri, 21 Jan 2022 11:20:39 +0200 Subject: [PATCH 08/20] force use of php 8.0.15 (instead of 8.0 which gave 8.1.1??) --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3b1f88e56..374dafe38 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - php_version: [7.2, 7.3, 7.4, 8.0] + php_version: [7.2, 7.3, 7.4, 8.0.15] experimental: [false] steps: From c5432136e6005927d9d6fd5834619fc5f3222c79 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Fri, 21 Jan 2022 16:43:53 +0200 Subject: [PATCH 09/20] use quoted PHP version numbers to avoid YAML interpreting 8.0 as a number --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 374dafe38..9477d555d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - php_version: [7.2, 7.3, 7.4, 8.0.15] + php_version: ["7.2", "7.3", "7.4", "8.0"] experimental: [false] steps: From e956bf48743e0eca3deb7ed77edafd2fab1c54aa Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Fri, 21 Jan 2022 16:44:37 +0200 Subject: [PATCH 10/20] enable convertDeprecationsToExceptions setting so phpunit will fail tests due to deprecation --- phpunit.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpunit.xml b/phpunit.xml index 8e6fc2a7b..f266bce76 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,4 +1,5 @@ - + From fe04455a88cb0a92cfac7b08d8e7acf7cd514a0a Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Fri, 21 Jan 2022 16:45:15 +0200 Subject: [PATCH 11/20] set error_reporting(E_ALL) for test so they will run the same way locally and under CI --- tests/bootstrap.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index f8175a878..e5e54e6bb 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,5 +1,7 @@ Date: Fri, 21 Jan 2022 16:53:08 +0200 Subject: [PATCH 12/20] fix some "Required param X follows optional parameter Y" deprecation errors --- model/Vocabulary.php | 2 +- model/sparql/GenericSparql.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/model/Vocabulary.php b/model/Vocabulary.php index 44716969e..afe731b54 100644 --- a/model/Vocabulary.php +++ b/model/Vocabulary.php @@ -423,7 +423,7 @@ public function getConceptBroaders($uri, $lang) * @param boolean $any set to true if you want to have a label even in case of a correct language one missing. * @param string $lang language identifier. */ - public function getConceptTransitiveBroaders($uri, $limit, $any = false, $lang) + public function getConceptTransitiveBroaders($uri, $limit, $any, $lang) { $lang = $lang ? $lang : $this->getEnvLang(); $fallback = $this->config->getDefaultLanguage(); diff --git a/model/sparql/GenericSparql.php b/model/sparql/GenericSparql.php index 6605102aa..ccf40b30b 100644 --- a/model/sparql/GenericSparql.php +++ b/model/sparql/GenericSparql.php @@ -1198,13 +1198,13 @@ private function transformConceptSearchResults($results, $vocabs, $fields) { /** * Query for concepts using a search term. * @param array $vocabs array of Vocabulary objects to search; empty for global search - * @param array $fields extra fields to include in the result (array of strings). (default: null = none) - * @param boolean $unique restrict results to unique concepts (default: false) - * @param boolean $showDeprecated whether to include deprecated concepts in the result (default: false) + * @param array $fields extra fields to include in the result (array of strings or null). + * @param boolean $unique restrict results to unique concepts * @param ConceptSearchParameters $params + * @param boolean $showDeprecated whether to include deprecated concepts in the result (default: false) * @return array query result object */ - public function queryConcepts($vocabs, $fields = null, $unique = false, $params, $showDeprecated = false) { + public function queryConcepts($vocabs, $fields, $unique, $params, $showDeprecated = false) { $query = $this->generateConceptSearchQuery($fields, $unique, $params,$showDeprecated); $results = $this->query($query); return $this->transformConceptSearchResults($results, $vocabs, $fields); From 31bc511573b3d52c1171064db98341cb6b96bc9c Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Fri, 21 Jan 2022 16:57:19 +0200 Subject: [PATCH 13/20] upgrade to mockery/mockery 1.5.* to avoid PHP 8.0 deprecation errors (may break PHP 7.2) --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 9a73d1313..83eb3c02c 100644 --- a/composer.json +++ b/composer.json @@ -84,7 +84,7 @@ "phpunit/phpunit": "8.5.*", "umpirsky/twig-gettext-extractor": "1.3.*", "symfony/dom-crawler": "3.4.3", - "mockery/mockery": "1.3.1" + "mockery/mockery": "1.5.*" }, "autoload": { "classmap": ["controller/", "model/", "model/sparql/"] From 918317195db155a70cd05d0dd8084a11c4b230cc Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Fri, 21 Jan 2022 17:01:39 +0200 Subject: [PATCH 14/20] update to symfony/dom-crawler 5.4.* to avoid PHP8 deprecation warnings --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 83eb3c02c..fa8631a1b 100644 --- a/composer.json +++ b/composer.json @@ -83,7 +83,7 @@ "require-dev": { "phpunit/phpunit": "8.5.*", "umpirsky/twig-gettext-extractor": "1.3.*", - "symfony/dom-crawler": "3.4.3", + "symfony/dom-crawler": "5.4.*", "mockery/mockery": "1.5.*" }, "autoload": { From be8d1c6670c6a36093458408040c6aaf002e2a03 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Fri, 21 Jan 2022 17:04:37 +0200 Subject: [PATCH 15/20] use mockery/mockery 1.3.5 as it supports both php 7.2 and 8.0 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index fa8631a1b..94e6c410b 100644 --- a/composer.json +++ b/composer.json @@ -84,7 +84,7 @@ "phpunit/phpunit": "8.5.*", "umpirsky/twig-gettext-extractor": "1.3.*", "symfony/dom-crawler": "5.4.*", - "mockery/mockery": "1.5.*" + "mockery/mockery": "1.3.5" }, "autoload": { "classmap": ["controller/", "model/", "model/sparql/"] From c9cd1fa540526fbc3dc393f59abfe5dfd2b8d0c9 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Fri, 21 Jan 2022 17:06:49 +0200 Subject: [PATCH 16/20] reenable Http304 tests as they are no longer getting stuck (why!?) --- tests/Http304Test.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tests/Http304Test.php b/tests/Http304Test.php index 108d480ee..cbeafe1b0 100644 --- a/tests/Http304Test.php +++ b/tests/Http304Test.php @@ -26,13 +26,6 @@ class Http304Test extends TestCase */ private $twig; - /* skip these tests for now, to diagnose PHP 8 issues */ - protected function setUp() : void - { - $this->markTestSkipped(); - } - - /** * Initializes the test objects. Not using setUp here as the $vocabularyName * needs to be specified per test. From 2b61f6e1181e18b2f99adc80289a4b9bcc314bb5 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Fri, 21 Jan 2022 17:07:41 +0200 Subject: [PATCH 17/20] disable verbose & debug phpunit output as it's not needed anymore for debugging --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9477d555d..a8e9a7e7e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,7 +53,6 @@ jobs: php_extensions: gettext intl xsl pcov memory_limit: 512M configuration: phpunit.xml - args: --verbose --debug - name: Publish code coverage to Code Climate uses: paambaati/codeclimate-action@v2.7.5 From 788b5df884e0496f221aeb693c8b469d830d90d3 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Mon, 24 Jan 2022 10:46:27 +0200 Subject: [PATCH 18/20] Disable code coverage reporting for PHP 8 (PHPUnit can't collect it) --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a8e9a7e7e..35e95a493 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,6 +60,10 @@ jobs: CC_TEST_REPORTER_ID: fb98170a5c7ea9cc2bbab19ff26268335e6a11a4f8267ca935e5e8ff4624886c with: prefix: /app + # PHPUnit 8.5 doesn't support code coverage for PHP 8 + if: ${{ matrix.php_version < "8.0" }} - name: Publish code coverage to Codecov uses: codecov/codecov-action@v1 + # PHPUnit 8.5 doesn't support code coverage for PHP 8 + if: ${{ matrix.php_version < "8.0" }} From 861d22f5f950aba1bde783faef50398c03925e62 Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Mon, 24 Jan 2022 10:50:06 +0200 Subject: [PATCH 19/20] use the right kind of quotes for conditional expressions --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 35e95a493..743499794 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,9 +61,9 @@ jobs: with: prefix: /app # PHPUnit 8.5 doesn't support code coverage for PHP 8 - if: ${{ matrix.php_version < "8.0" }} + if: ${{ matrix.php_version < '8.0' }} - name: Publish code coverage to Codecov uses: codecov/codecov-action@v1 # PHPUnit 8.5 doesn't support code coverage for PHP 8 - if: ${{ matrix.php_version < "8.0" }} + if: ${{ matrix.php_version < '8.0' }} From 5e0de26d2cd6d978ca971e533dc70bdd6f11d5bd Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Mon, 24 Jan 2022 10:57:16 +0200 Subject: [PATCH 20/20] Include PHP 8.1 in CI tests in experimental mode (allowed to fail) --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 743499794..d36e1946d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,6 +12,9 @@ jobs: matrix: php_version: ["7.2", "7.3", "7.4", "8.0"] experimental: [false] + include: + - php_version: "8.1" + experimental: true steps: - name: Check out repository code