Skip to content

Commit 1858e73

Browse files
committed
[Turbo] Drop Symfony PHPUnit Bridge in favor of PHPUnit >= 11.0
1 parent 409fb33 commit 1858e73

File tree

7 files changed

+47
-33
lines changed

7 files changed

+47
-33
lines changed

src/Turbo/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/composer.lock
44
/drivers/
55
/phpunit.xml
6-
/.phpunit.result.cache
6+
/.phpunit.cache
77
/tests/app/assets/vendor/
88
/tests/app/public/assets/
99
/tests/app/public/build/

src/Turbo/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"symfony/mercure-bundle": "^0.3.7",
4949
"symfony/messenger": "^6.4|^7.0|^8.0",
5050
"symfony/panther": "^2.2",
51-
"symfony/phpunit-bridge": "^7.2|^8.0",
51+
"phpunit/phpunit": "^11.1|^12.0",
5252
"symfony/process": "^6.4|^7.0|^8.0",
5353
"symfony/property-access": "^6.4|^7.0|^8.0",
5454
"symfony/security-core": "^6.4|^7.0|^8.0",

src/Turbo/phpstan.dist.neon

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ parameters:
1010
# to allow installing with various phsptan versions without reporting old errors here
1111
reportUnmatchedIgnoredErrors: false
1212
inferPrivatePropertyTypeFromConstructor: true
13-
bootstrapFiles:
14-
- vendor/bin/.phpunit/phpunit/vendor/autoload.php
1513
ignoreErrors:
1614
-
1715
message: "#^Method .*::test.*\\(\\) has no return type specified\\.$#"

src/Turbo/phpunit.xml.dist renamed to src/Turbo/phpunit.dist.xml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
33
<phpunit
44
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5-
xsi:noNamespaceSchemaLocation="vendor/bin/.phpunit/phpunit.xsd"
5+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
66
colors="true"
7-
bootstrap="vendor/autoload.php"
7+
bootstrap="tests/bootstrap.php"
8+
failOnDeprecation="true"
89
failOnRisky="true"
910
failOnWarning="true"
11+
cacheDirectory=".phpunit.cache"
1012
>
1113
<php>
1214
<ini name="error_reporting" value="-1"/>
1315
<env name="SHELL_VERBOSITY" value="-1"/>
14-
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=0&amp;max[direct]=0"/>
1516
<env name="APP_ENV" value="test" force="true" />
1617
<env name="APP_DEBUG" value="true" force="true" />
1718
<env name="KERNEL_CLASS" value="App\Kernel"/>
@@ -25,17 +26,18 @@
2526
</testsuite>
2627
</testsuites>
2728

28-
<coverage>
29+
<source
30+
ignoreSuppressionOfDeprecations="true"
31+
ignoreIndirectDeprecations="true"
32+
restrictNotices="true"
33+
restrictWarnings="true"
34+
>
2935
<include>
30-
<directory>./src</directory>
36+
<directory>src</directory>
3137
</include>
32-
</coverage>
3338

34-
<listeners>
35-
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
36-
</listeners>
37-
38-
<extensions>
39-
<extension class="Symfony\Component\Panther\ServerExtension"/>
40-
</extensions>
39+
<deprecationTrigger>
40+
<function>trigger_deprecation</function>
41+
</deprecationTrigger>
42+
</source>
4143
</phpunit>

src/Turbo/tests/Bridge/Mercure/TurboStreamListenRendererTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@
1212
namespace Symfony\UX\Turbo\Tests\Bridge\Mercure;
1313

1414
use App\Entity\Book;
15+
use PHPUnit\Framework\Attributes\DataProvider;
1516
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
1617
use Symfony\UX\StimulusBundle\Dto\StimulusAttributes;
1718

1819
final class TurboStreamListenRendererTest extends KernelTestCase
1920
{
2021
/**
21-
* @dataProvider provideTestCases
22-
*
2322
* @param array<mixed> $context
2423
*/
24+
#[DataProvider('provideTestCases')]
2525
public function testRenderTurboStreamListen(string $template, array $context, string $expectedResult)
2626
{
2727
$twig = self::getContainer()->get('twig');

src/Turbo/tests/Helper/TurboStreamTest.php

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@
1111

1212
namespace Symfony\UX\Turbo\Tests\Helper;
1313

14+
use PHPUnit\Framework\Attributes\DataProvider;
15+
use PHPUnit\Framework\Attributes\TestWith;
1416
use PHPUnit\Framework\TestCase;
1517
use Symfony\UX\Turbo\Helper\TurboStream;
1618

1719
class TurboStreamTest extends TestCase
1820
{
19-
/**
20-
* @testWith ["append"]
21-
* ["prepend"]
22-
* ["replace"]
23-
* ["update"]
24-
* ["before"]
25-
* ["after"]
26-
*/
21+
#[TestWith(['append'])]
22+
#[TestWith(['prepend'])]
23+
#[TestWith(['replace'])]
24+
#[TestWith(['update'])]
25+
#[TestWith(['before'])]
26+
#[TestWith(['after'])]
2727
public function testStream(string $action)
2828
{
2929
$this->assertSame(<<<EOHTML
@@ -35,10 +35,8 @@ public function testStream(string $action)
3535
);
3636
}
3737

38-
/**
39-
* @testWith ["replace"]
40-
* ["update"]
41-
*/
38+
#[TestWith(['replace'])]
39+
#[TestWith(['update'])]
4240
public function testStreamMorph(string $action)
4341
{
4442
$this->assertSame(<<<EOHTML
@@ -89,10 +87,9 @@ public function testCustom()
8987
}
9088

9189
/**
92-
* @dataProvider customThrowsExceptionDataProvider
93-
*
9490
* @param array<string, string|int|float|null> $attr
9591
*/
92+
#[DataProvider('customThrowsExceptionDataProvider')]
9693
public function testCustomThrowsException(string $action, string $target, string $html, array $attr)
9794
{
9895
$this->expectException(\InvalidArgumentException::class);

src/Turbo/tests/bootstrap.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
use Symfony\Component\ErrorHandler\ErrorHandler;
13+
14+
require __DIR__.'/../vendor/autoload.php';
15+
16+
// @see https://github.com/symfony/symfony/issues/53812
17+
ErrorHandler::register(null, false);

0 commit comments

Comments
 (0)