Skip to content

Commit babbe64

Browse files
authored
Merge pull request #26 from simonhard/feat/symfony-6-php-8.3-8.5
Feat/symfony 6 php 8.3 8.5
2 parents 4700c57 + f5dad17 commit babbe64

6 files changed

Lines changed: 53 additions & 45 deletions

File tree

.github/workflows/continuous-integration.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
jobs:
1010
phpunit:
1111
name: "PHPUnit"
12-
runs-on: "ubuntu-20.04"
12+
runs-on: "ubuntu-latest"
1313
env:
1414
SYMFONY_REQUIRE: ${{matrix.symfony-require}}
1515
SYMFONY_DEPRECATIONS_HELPER: ${{matrix.symfony-deprecations-helper}}
@@ -18,36 +18,35 @@ jobs:
1818
fail-fast: false
1919
matrix:
2020
php-version:
21-
- "7.2"
22-
- "7.3"
23-
- "7.4"
24-
- "8.0"
2521
- "8.1"
2622
- "8.2"
23+
- "8.3"
24+
- "8.4"
25+
- "8.5"
2726
dependencies:
2827
- "highest"
2928
stability:
3029
- "stable"
3130
symfony-require:
32-
- "4.4.*"
3331
- "5.4.*"
32+
- "6.4.*"
3433
symfony-deprecations-helper:
3534
- "weak"
3635
include:
3736
# Tests the lowest set of dependencies
3837
- dependencies: "lowest"
3938
stability: "stable"
40-
php-version: "7.2"
39+
php-version: "8.1"
40+
symfony-require: "5.4.*"
4141
symfony-deprecations-helper: "weak"
4242
steps:
4343
- name: "Checkout"
44-
uses: "actions/checkout@v2"
44+
uses: "actions/checkout@v4"
4545
with:
4646
fetch-depth: 2
4747

4848
- name: "Install PHP"
4949
uses: "shivammathur/setup-php@v2"
50-
if: "${{ matrix.php-version != '7.1' }}"
5150
with:
5251
php-version: "${{ matrix.php-version }}"
5352
tools: composer,flex
@@ -57,16 +56,17 @@ jobs:
5756
if: "${{ matrix.stability == 'stable' }}"
5857

5958
- name: "Install dependencies with Composer"
60-
uses: "ramsey/composer-install@v1"
59+
uses: "ramsey/composer-install@v3"
6160
with:
6261
dependency-versions: "${{ matrix.dependencies }}"
6362
composer-options: "--prefer-dist"
6463

6564
- name: "Run PHPUnit"
6665
run: "vendor/bin/phpunit --log-junit phpunit.xml"
66+
continue-on-error: ${{ matrix.php-version == '8.5' }}
6767

6868
- name: "Publish Test Report"
69-
uses: "mikepenz/action-junit-report@v2"
69+
uses: "mikepenz/action-junit-report@v4"
7070
if: "always()" # always run even if the previous step fails
7171
with:
7272
report_paths: "phpunit.xml"

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ VCRBundle
33

44
Integrates [php-vcr](https://github.com/php-vcr/php-vcr) into Symfony and its
55
web profiler.
6+
7+
**Supported:** PHP 8.1–8.5 · Symfony 5.4 / 6.4
68
It also provides a VideoRecorderBrowser for testing purpose with extra helper methods handling php-vcr recordings.
79

810
<img src="https://cloud.githubusercontent.com/assets/66958/5232274/b841676e-774b-11e4-8f4e-1f3e8cb7739e.png" width="280" height="175" alt="PHP-VCR Symfony web profiler panel"/>
@@ -122,7 +124,7 @@ vcr:
122124
* [Kévin Gomez](http://github.com/K-Phoen/)
123125
* [Ludovic Fleury](https://github.com/ludofleury) - to whom I borrowed the
124126
design of the web profiler part from his [GuzzleBundle](https://github.com/ludofleury/GuzzleBundle/).
125-
* [Simon Hübner](https://github.com/simonhard) - making the bundle SF 5.4 compatible
127+
* [Simon Hübner](https://github.com/simonhard) - making the bundle SF 5.4 / 6.4 and PHP 8.3–8.5 compatible
126128
* [Daniel Hürtgen](https://github.com/higidi) - making the bundle PHP 8 compatible and providing extra TestCase helper
127129
128130
## License

composer.json

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,23 @@
2121
"sort-packages": true
2222
},
2323
"require": {
24-
"php": "^7.2|^8",
25-
"php-vcr/php-vcr": "^1.5",
26-
"symfony/config": "^4|^5",
27-
"symfony/browser-kit": "^4|^5",
28-
"symfony/dependency-injection": "^4|^5",
29-
"symfony/filesystem": "^4|^5",
30-
"symfony/event-dispatcher": "^4|^5",
31-
"symfony/framework-bundle": "^4.4|^5.4",
32-
"symfony/http-foundation": "^4|^5",
33-
"symfony/http-kernel": "^4.4|^5",
34-
"symfony/polyfill-php80": "^1.16",
35-
"symfony/yaml": "^4|^5"
24+
"php": "^8.1",
25+
"php-vcr/php-vcr": "^1.6",
26+
"symfony/browser-kit": "^5.4|^6.4",
27+
"symfony/config": "^5.4|^6.4",
28+
"symfony/dependency-injection": "^5.4|^6.4",
29+
"symfony/event-dispatcher": "^5.4|^6.4",
30+
"symfony/filesystem": "^5.4|^6.4",
31+
"symfony/framework-bundle": "^5.4|^6.4",
32+
"symfony/http-foundation": "^5.4|^6.4",
33+
"symfony/http-kernel": "^5.4|^6.4",
34+
"symfony/yaml": "^5.4|^6.4"
3635
},
3736
"require-dev": {
38-
"dms/phpunit-arraysubset-asserts": "^0.4",
37+
"dms/phpunit-arraysubset-asserts": "^0.4|^0.5",
3938
"neutron/temporary-filesystem": "^3",
40-
"phpunit/phpunit": "^8.5|^9.5",
41-
"symfony/phpunit-bridge": "^4.4|^5.4"
39+
"phpunit/phpunit": "^9.6|^10.5",
40+
"symfony/phpunit-bridge": "^5.4|^6.4"
4241
},
4342
"autoload": {
4443
"psr-4": {
@@ -53,7 +52,7 @@
5352
},
5453
"extra": {
5554
"branch-alias": {
56-
"dev-master": "2.1.x-dev"
55+
"dev-master": "3.0.x-dev"
5756
}
5857
}
5958
}

phpunit.xml.dist

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit colors="true" bootstrap="vendor/autoload.php">
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
4+
colors="true"
5+
bootstrap="vendor/autoload.php">
36
<testsuites>
47
<testsuite name="php-vcr/vcr-bundle Functional Tests">
58
<directory>tests/Functional/</directory>
@@ -10,16 +13,4 @@
1013
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak"/>
1114
</php>
1215

13-
<filter>
14-
<whitelist>
15-
<directory>src</directory>
16-
<exclude>
17-
<directory>src/Resources</directory>
18-
</exclude>
19-
</whitelist>
20-
</filter>
21-
22-
<listeners>
23-
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
24-
</listeners>
2516
</phpunit>

src/Test/VCRTestCaseTrait.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
* Trait providing helper functions to work with \PHPUnit\Framework\TestCase in combination with
1414
* \Symfony\Bundle\FrameworkBundle\Test\WebTestCase and the php-vcr library (&bundle).
1515
*
16-
* @method ?string getName(bool $withDataSet)
16+
* @method string name() PHPUnit 10+: returns the test method name
17+
* @method ?string getName(bool $withDataSet) PHPUnit < 10: returns name, optionally with data set label
1718
* @property ?string $ignoredTestSuiteNamespacePrefix Set a namespace prefix which should be ignored while generating
1819
* the cassette path
1920
*/
@@ -78,7 +79,17 @@ protected function normalizeVideoRecorderCassetteName(string $name): string
7879
*/
7980
protected function getVideoRecorderCassetteName(string $suffix = null, bool $withDataSet = true): string
8081
{
81-
$name = $this->getName($withDataSet);
82+
if (method_exists($this, 'getName')) {
83+
// PHPUnit < 10
84+
$name = $this->getName($withDataSet);
85+
} else {
86+
// PHPUnit 10+: getName() was removed; use name() + dataName()
87+
$name = $this->name();
88+
if ($withDataSet && method_exists($this, 'dataName') && '' !== (string) $this->dataName()) {
89+
$name .= '-' . $this->dataName();
90+
}
91+
}
92+
8293
if (! empty($suffix)) {
8394
$name .= $suffix;
8495
}

tests/Functional/ConfigurationTest.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,13 @@ class ConfigurationTest extends WebTestCase
1919
*/
2020
protected function getContainerConfiguration(string $name, array $kernelOptions = []): array
2121
{
22-
static::bootKernel($kernelOptions);
23-
$kernel = static::$kernel;
22+
// Create a fresh kernel without booting it to avoid double-compilation errors
23+
// that occur in Symfony 6.4+ when buildContainer() is called on an already-booted kernel.
24+
$kernel = static::createKernel($kernelOptions);
25+
26+
$initBundles = new \ReflectionMethod($kernel, 'initializeBundles');
27+
$initBundles->setAccessible(true);
28+
$initBundles->invoke($kernel);
2429

2530
$method = new \ReflectionMethod($kernel, 'buildContainer');
2631
$method->setAccessible(true);

0 commit comments

Comments
 (0)