Skip to content

Commit 5d85483

Browse files
Add PHP 8 support
1 parent d6bde41 commit 5d85483

File tree

7 files changed

+121
-94
lines changed

7 files changed

+121
-94
lines changed
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: PHP Test
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- 'master'
8+
- '[0-9]+.x'
9+
- '[0-9]+.[0-9]+'
10+
- '[0-9]+.[0-9]+.x'
11+
12+
jobs:
13+
test:
14+
name: '${{ matrix.php-version }} ${{ matrix.dependencies }}, Storage ${{ matrix.storage }}, Coverage ${{ matrix.coverage }}'
15+
runs-on: ubuntu-20.04
16+
env:
17+
COVERAGE: ${{ matrix.coverage }}
18+
STORAGE: ${{ matrix.storage }}
19+
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
- php-version: '5.6'
25+
dependencies: 'lowest'
26+
storage: doctrine
27+
- php-version: '5.6'
28+
storage: doctrine
29+
- php-version: '5.6'
30+
storage: array
31+
32+
- php-version: '7.0'
33+
dependencies: 'lowest'
34+
storage: doctrine
35+
- php-version: '7.0'
36+
storage: doctrine
37+
- php-version: '7.0'
38+
storage: array
39+
40+
- php-version: '7.1'
41+
dependencies: 'lowest'
42+
storage: doctrine
43+
- php-version: '7.1'
44+
storage: doctrine
45+
- php-version: '7.1'
46+
storage: array
47+
48+
- php-version: '7.2'
49+
dependencies: 'lowest'
50+
storage: doctrine
51+
- php-version: '7.2'
52+
storage: doctrine
53+
- php-version: '7.2'
54+
storage: array
55+
56+
- php-version: '7.3'
57+
storage: doctrine
58+
- php-version: '7.3'
59+
storage: array
60+
61+
- php-version: '7.4'
62+
storage: doctrine
63+
- php-version: '7.4'
64+
storage: array
65+
66+
- php-version: '8.0'
67+
storage: doctrine
68+
- php-version: '8.0'
69+
storage: array
70+
71+
steps:
72+
- name: Checkout project
73+
uses: actions/checkout@v2
74+
75+
- name: Install and configure PHP
76+
uses: shivammathur/setup-php@v2
77+
with:
78+
php-version: ${{ matrix.php-version }}
79+
extensions: "pdo, pdo_sqlite"
80+
coverage: "pcov"
81+
tools: 'composer:v2'
82+
83+
- name: Install dependencies with Composer
84+
uses: ramsey/composer-install@v1
85+
with:
86+
dependency-versions: ${{ matrix.dependencies }}
87+
composer-options: --prefer-dist --no-suggest
88+
89+
- name: Doctrine
90+
if: "${{ matrix.coverage }} == 'doctrine'"
91+
run: |
92+
tests/app/console doctrine:database:create
93+
tests/app/console doctrine:schema:create
94+
95+
- name: Execute test
96+
run: vendor/bin/simple-phpunit -c phpunit.xml.dist --coverage-clover=coverage.clover
97+
98+
- name: Coverage
99+
if: ${{ matrix.coverage }}
100+
run: |
101+
wget https://scrutinizer-ci.com/ocular.phar
102+
php ocular.phar code-coverage:upload --access-token="230ec5e01daf5bb3e46ea304fb20348b52d80de73463ec08ee9c96fcd1349e35" --format=php-clover coverage.clover

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ composer.phar
88
/tests/app/cache/
99
/tests/app/logs/
1010
/tests/app/data/
11+
var/

.travis.yml

Lines changed: 0 additions & 88 deletions
This file was deleted.

composer.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
}
1111
],
1212
"require": {
13-
"php": "^5.6 || ^7.0",
13+
"php": "^5.6 || ^7.0 || ^8.0",
1414
"php-task/php-task": "^1.4",
1515
"symfony/http-kernel": "^2.8 || ^3.4 || ^4.0 || ^5.0",
1616
"symfony/dependency-injection": "^2.8 || ^3.4 || ^4.0 || ^5.0",
@@ -21,13 +21,12 @@
2121
"doctrine/orm": "^2.5"
2222
},
2323
"require-dev": {
24-
"phpunit/phpunit": "^4.8 || ^5.0",
25-
"sebastian/comparator": "^1.2.3",
2624
"symfony/debug": "^2.8 || ^3.4 || ^4.0 || ^5.0",
2725
"symfony/framework-bundle": "^2.8 || ^3.4 || ^4.0 || ^5.0",
2826
"symfony/finder": "^2.8 || ^3.4 || ^4.0 || ^5.0",
2927
"symfony/yaml": "^2.8 || ^3.4 || ^4.0 || ^5.0",
30-
"doctrine/doctrine-bundle": "^1.5",
28+
"symfony/phpunit-bridge": "^5.2.3",
29+
"doctrine/doctrine-bundle": "^1.5 || ^2.0",
3130
"doctrine/data-fixtures": "^1.1"
3231
},
3332
"autoload": {

phpunit.xml.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
<ini name="error_reporting" value="-1" />
1010
<server name="KERNEL_DIR" value="tests/app" />
1111
<server name="KERNEL_CLASS" value="TestKernel" />
12+
<env name="SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT" value="1"/>
13+
<env name="SYMFONY_PHPUNIT_REMOVE" value="symfony/yaml"/>
14+
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak"/>
1215
</php>
1316

1417
<testsuites>

tests/app/TestKernel.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,14 @@ protected function initializeContainer()
100100

101101
$this->debug = $debug;
102102
}
103+
104+
protected function getKernelParameters()
105+
{
106+
return array_merge(
107+
parent::getKernelParameters(),
108+
[
109+
'kernel.test_root_dir' => __DIR__,
110+
]
111+
);
112+
}
103113
}

tests/app/config/config.doctrine.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ task:
99
executor:
1010
type: separate
1111
separate:
12-
console_path: '%kernel.root_dir%/console'
12+
console_path: '%kernel.test_root_dir%/console'
1313

1414
doctrine:
1515
orm:
@@ -23,4 +23,4 @@ doctrine:
2323
user: root
2424
password: ~
2525
charset: UTF8
26-
path: '%kernel.root_dir%/data/database.sqlite'
26+
path: '%kernel.test_root_dir%/data/database.sqlite'

0 commit comments

Comments
 (0)