Skip to content

Commit 12db13e

Browse files
Add support for Symfony ^6.0 (#5)
* support symfony 6 * add php 8.2-8.4; also check with 5.0 family * switch to ramsey/composer-install
1 parent c9ec29e commit 12db13e

File tree

5 files changed

+56
-52
lines changed

5 files changed

+56
-52
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,19 @@ jobs:
1010
strategy:
1111
fail-fast: false
1212
matrix:
13-
php: [ '7.4', '8.0', '8.1' ]
14-
composer: [ '', '--prefer-lowest' ]
13+
php:
14+
- '7.4'
15+
- '8.0'
16+
- '8.1'
17+
- '8.2'
18+
- '8.3'
19+
- '8.4'
20+
deps:
21+
- 'highest'
22+
- 'lowest'
1523

1624
steps:
17-
- uses: actions/checkout@v3
25+
- uses: actions/checkout@v4
1826

1927
- name: Use PHP
2028
uses: shivammathur/setup-php@v2
@@ -32,22 +40,22 @@ jobs:
3240

3341
- name: cache dependencies
3442
id: cache-dependencies
35-
uses: actions/cache@v3
43+
uses: actions/cache@v4
3644
with:
3745
path: ${{ steps.composer-cache.outputs.dir }}
38-
key: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.composer }}-composer-${{ hashFiles('**/composer.lock') }}
46+
key: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.deps }}-composer-${{ hashFiles('**/composer.lock') }}
3947
restore-keys: |
40-
${{ runner.os }}-${{ matrix.php }}-${{ matrix.composer }}-composer-
48+
${{ runner.os }}-${{ matrix.php }}-${{ matrix.deps }}-composer-
4149
4250
- name: Validate composer.json and composer.lock
4351
run: composer validate
4452
working-directory: ./
4553

4654
- name: Install dependencies
47-
env:
48-
COMPOSER_FLAGS: ${{ matrix.composer }}
49-
run: composer update ${COMPOSER_FLAGS} --prefer-source
50-
working-directory: ./
55+
uses: ramsey/composer-install@v3
56+
with:
57+
dependency-versions: '${{ matrix.deps }}'
58+
working-directory: ./
5159

5260

5361
- name: Run Tests

Framework/Test/ServiceTestCase.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static private function getPhpUnitCliConfigArgument()
9494
*/
9595
static protected function getKernelClass()
9696
{
97-
$dir = isset($_SERVER['KERNEL_DIR']) ? $_SERVER['KERNEL_DIR'] : static::getPhpUnitXmlDir();
97+
$dir = $_SERVER['KERNEL_DIR'] ?? static::getPhpUnitXmlDir();
9898

9999
$finder = new Finder();
100100
$finder->name('*Kernel.php')->depth(0)->in($dir);
@@ -123,15 +123,15 @@ static protected function getKernelClass()
123123
*
124124
* @return HttpKernelInterface A HttpKernelInterface instance
125125
*/
126-
static protected function createKernel(array $options = array())
126+
static protected function createKernel(array $options = [])
127127
{
128128
if (null === static::$class) {
129129
static::$class = static::getKernelClass();
130130
}
131131

132132
return new static::$class(
133-
isset($options['environment']) ? $options['environment'] : 'test',
134-
isset($options['debug']) ? $options['debug'] : true
133+
$options['environment'] ?? 'test',
134+
$options['debug'] ?? true
135135
);
136136
}
137137

Tests/TestKernel.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,16 @@ public function getRootDir()
1111
{
1212
return __DIR__.'/Resources';
1313
}
14-
public function registerBundles()
14+
public function registerBundles(): iterable
1515
{
16-
return array(
17-
);
16+
return [];
1817
}
1918
public function registerContainerConfiguration(LoaderInterface $loader)
2019
{
2120
$loader->load(__DIR__.'/Resources/config/config_test.yml');
2221
if (class_exists('Symfony\Component\Asset\Package')) {
2322
$loader->load(function (ContainerBuilder $container) {
24-
$container->loadFromExtension('framework', array('assets' => array()));
23+
$container->loadFromExtension('framework', ['assets' => []]);
2524
});
2625
}
2726
}

composer.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@
2121
],
2222
"require": {
2323
"php": ">=7.4",
24-
"symfony/http-kernel": "^4.4.12|^5.0",
24+
"symfony/http-kernel": "^4.4.12|^5.0|^6.0",
2525
"phpunit/phpunit": "^8.5.23|^9.0"
2626
},
2727
"require-dev": {
28-
"symfony/config": "^4.4.12|^5.0",
29-
"symfony/dependency-injection": "^4.4.12|^5.0",
30-
"symfony/yaml": "^4.4.12|^5.0"
28+
"symfony/config": "^4.4.12|^5.0|^6.0",
29+
"symfony/dependency-injection": "^4.4.12|^5.0|^6.0",
30+
"symfony/yaml": "^4.4.12|^5.0|^6.0",
31+
"rector/rector": "^0.19.0"
3132
},
3233
"autoload": {
3334
"psr-4": {

phpunit.xml.dist

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,35 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit backupGlobals="false"
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
backupGlobals="false"
34
backupStaticAttributes="false"
45
colors="true"
56
convertErrorsToExceptions="true"
67
convertNoticesToExceptions="true"
78
convertWarningsToExceptions="true"
89
processIsolation="false"
910
stopOnFailure="false"
10-
syntaxCheck="false"
11-
bootstrap="Tests/autoload.php">
12-
13-
<php>
14-
<ini name="error_reporting" value="-1"/>
15-
<server name="KERNEL_DIR" value="./Tests/" />
16-
</php>
17-
18-
<testsuites>
19-
<testsuite name="ServiceTestHelper Test Suite">
20-
<directory suffix="Test.php">./Tests</directory>
21-
</testsuite>
22-
</testsuites>
23-
24-
<logging>
25-
<log type="junit" target="build/logs/junit.xml"
26-
logIncompleteSkipped="false"/>
27-
</logging>
28-
29-
<filter>
30-
<whitelist>
31-
<directory>./</directory>
32-
<exclude>
33-
<directory>./Tests</directory>
34-
<directory>./vendor</directory>
35-
<directory>./Resources</directory>
36-
</exclude>
37-
</whitelist>
38-
</filter>
11+
bootstrap="Tests/autoload.php"
12+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
13+
<coverage>
14+
<include>
15+
<directory>./</directory>
16+
</include>
17+
<exclude>
18+
<directory>./Tests</directory>
19+
<directory>./vendor</directory>
20+
<directory>./Resources</directory>
21+
</exclude>
22+
</coverage>
23+
<php>
24+
<ini name="error_reporting" value="-1"/>
25+
<server name="KERNEL_DIR" value="./Tests/"/>
26+
</php>
27+
<testsuites>
28+
<testsuite name="ServiceTestHelper Test Suite">
29+
<directory suffix="Test.php">./Tests</directory>
30+
</testsuite>
31+
</testsuites>
32+
<logging>
33+
<junit outputFile="build/logs/junit.xml"/>
34+
</logging>
3935
</phpunit>

0 commit comments

Comments
 (0)