Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support PHP 8.0 #1266

Merged
merged 20 commits into from
Feb 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
abbd5ae
Upgrade to willdurand/negotiation 3.0.x which supports PHP 8
osma Jan 20, 2022
a1b3f19
Reenable PHP 8.0 CI jobs (not experimental anymore - let's see if it …
osma Jan 20, 2022
7283ff2
upgrade to php-actions/phpunit v3 to see if it helps diagnosing hangi…
osma Jan 20, 2022
62dd0a1
set a 10 minute timeout on the CI action (instead of default 6 hours)
osma Jan 21, 2022
cbd860d
enable verbose & debug output for PHPUnit
osma Jan 21, 2022
5dc322d
skip Http304 tests that seem to be getting stuck under GitHub Actions CI
osma Jan 21, 2022
85d0392
set path to phpunit.xml under GitHub Actions CI
osma Jan 21, 2022
2fdcbcc
force use of php 8.0.15 (instead of 8.0 which gave 8.1.1??)
osma Jan 21, 2022
c543213
use quoted PHP version numbers to avoid YAML interpreting 8.0 as a nu…
osma Jan 21, 2022
e956bf4
enable convertDeprecationsToExceptions setting so phpunit will fail t…
osma Jan 21, 2022
fe04455
set error_reporting(E_ALL) for test so they will run the same way loc…
osma Jan 21, 2022
5874e1b
fix some "Required param X follows optional parameter Y" deprecation …
osma Jan 21, 2022
31bc511
upgrade to mockery/mockery 1.5.* to avoid PHP 8.0 deprecation errors …
osma Jan 21, 2022
9183171
update to symfony/dom-crawler 5.4.* to avoid PHP8 deprecation warnings
osma Jan 21, 2022
be8d1c6
use mockery/mockery 1.3.5 as it supports both php 7.2 and 8.0
osma Jan 21, 2022
c9cd1fa
reenable Http304 tests as they are no longer getting stuck (why!?)
osma Jan 21, 2022
2b61f6e
disable verbose & debug phpunit output as it's not needed anymore for…
osma Jan 21, 2022
788b5df
Disable code coverage reporting for PHP 8 (PHPUnit can't collect it)
osma Jan 24, 2022
861d22f
use the right kind of quotes for conditional expressions
osma Jan 24, 2022
5e0de26
Include PHP 8.1 in CI tests in experimental mode (allowed to fail)
osma Jan 24, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ on: [push]
jobs:
build-test:
runs-on: ubuntu-latest
timeout-minutes: 10
continue-on-error: ${{ matrix.experimental }}
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]
include:
- php_version: "8.1"
experimental: true

steps:
- name: Check out repository code
Expand Down Expand Up @@ -43,21 +47,26 @@ 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:
version: 8.5
php_version: ${{ matrix.php_version }}
php_extensions: gettext intl xsl pcov
memory_limit: 512M
configuration: phpunit.xml

- name: Publish code coverage to Code Climate
uses: paambaati/codeclimate-action@v2.7.5
env:
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' }}
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.*",
Expand All @@ -83,8 +83,8 @@
"require-dev": {
"phpunit/phpunit": "8.5.*",
"umpirsky/twig-gettext-extractor": "1.3.*",
"symfony/dom-crawler": "3.4.3",
"mockery/mockery": "1.3.1"
"symfony/dom-crawler": "5.4.*",
"mockery/mockery": "1.3.5"
},
"autoload": {
"classmap": ["controller/", "model/", "model/sparql/"]
Expand Down
2 changes: 1 addition & 1 deletion model/Vocabulary.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions model/sparql/GenericSparql.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<phpunit colors="true" bootstrap="tests/bootstrap.php" processIsolation="true">
<phpunit colors="true" bootstrap="tests/bootstrap.php" processIsolation="true"
convertDeprecationsToExceptions="true">
<logging>
<log type="coverage-html" target="./report" lowUpperBound="35" highLowerBound="70"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
Expand Down
2 changes: 2 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

error_reporting(E_ALL);

// make sure that a SPARQL endpoint is set by an environment variable
$endpoint = getenv('SKOSMOS_SPARQL_ENDPOINT');
if (!$endpoint) {
Expand Down