Skip to content

Commit 5bd2f3e

Browse files
committed
[StimulusBundle] Drop Symfony PHPUnit Bridge in favor of PHPUnit >= 11.0
1 parent aa484e0 commit 5bd2f3e

File tree

6 files changed

+42
-28
lines changed

6 files changed

+42
-28
lines changed

src/StimulusBundle/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/vendor/
33
/composer.lock
44
/phpunit.xml
5-
/.phpunit.result.cache
5+
/.phpunit.cache
66

77
/tests/fixtures/var
8+
/config/reference.php

src/StimulusBundle/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525
"symfony/asset-mapper": "<6.4"
2626
},
2727
"require-dev": {
28+
"phpunit/phpunit": "^11.1|^12.0",
2829
"symfony/asset-mapper": "^6.4|^7.0|^8.0",
2930
"symfony/framework-bundle": "^6.4|^7.0|^8.0",
30-
"symfony/phpunit-bridge": "^7.2|^8.0",
3131
"symfony/twig-bundle": "^6.4|^7.0|^8.0",
32-
"zenstruck/browser": "^1.4"
32+
"zenstruck/browser": "^1.9"
3333
},
3434
"minimum-stability": "dev",
3535
"autoload": {

src/StimulusBundle/phpunit.xml.dist renamed to src/StimulusBundle/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="KERNEL_CLASS" value="Symfony\UX\Autocomplete\Tests\Fixtures\Kernel"/>
1617
<env name="DATABASE_URL" value="sqlite:///%kernel.project_dir%/var/data.db"/>
1718
</php>
@@ -22,17 +23,18 @@
2223
</testsuite>
2324
</testsuites>
2425

25-
<coverage>
26+
<source
27+
ignoreSuppressionOfDeprecations="true"
28+
ignoreIndirectDeprecations="true"
29+
restrictNotices="true"
30+
restrictWarnings="true"
31+
>
2632
<include>
27-
<directory>./src</directory>
33+
<directory>src</directory>
2834
</include>
29-
</coverage>
3035

31-
<listeners>
32-
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
33-
</listeners>
34-
35-
<extensions>
36-
<extension class="Zenstruck\Browser\Test\BrowserExtension"/>
37-
</extensions>
36+
<deprecationTrigger>
37+
<function>trigger_deprecation</function>
38+
</deprecationTrigger>
39+
</source>
3840
</phpunit>

src/StimulusBundle/tests/Dto/StimulusAttributesTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\UX\StimulusBundle\Tests\Dto;
1313

14+
use PHPUnit\Framework\Attributes\DataProvider;
1415
use PHPUnit\Framework\TestCase;
1516
use Symfony\UX\StimulusBundle\Dto\StimulusAttributes;
1617
use Twig\Environment;
@@ -149,9 +150,7 @@ public function testAddAttribute()
149150
$this->assertSame(['foo' => 'bar baz'], $this->stimulusAttributes->toArray());
150151
}
151152

152-
/**
153-
* @dataProvider provideAddComplexActionData
154-
*/
153+
#[DataProvider('provideAddComplexActionData')]
155154
public function testAddComplexAction(string $controllerName, string $actionName, ?string $eventName, string $expectedAction)
156155
{
157156
$this->stimulusAttributes->addAction($controllerName, $actionName, $eventName);

src/StimulusBundle/tests/Twig/StimulusTwigExtensionTest.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\UX\StimulusBundle\Tests\Twig;
1313

14+
use PHPUnit\Framework\Attributes\DataProvider;
1415
use PHPUnit\Framework\TestCase;
1516
use Symfony\UX\StimulusBundle\Helper\StimulusHelper;
1617
use Symfony\UX\StimulusBundle\Tests\StimulusIntegrationTestKernel;
@@ -29,9 +30,7 @@ protected function setUp(): void
2930
$this->twig = $container->get(Environment::class);
3031
}
3132

32-
/**
33-
* @dataProvider provideRenderStimulusController
34-
*/
33+
#[DataProvider('provideRenderStimulusController')]
3534
public function testRenderStimulusController(string $controllerName, array $controllerValues, array $controllerClasses, array $controllerOutlets, string $expectedString, array $expectedArray)
3635
{
3736
$extension = new StimulusTwigExtension(new StimulusHelper($this->twig));
@@ -140,9 +139,7 @@ public function testAppendStimulusController()
140139
);
141140
}
142141

143-
/**
144-
* @dataProvider provideRenderStimulusAction
145-
*/
142+
#[DataProvider('provideRenderStimulusAction')]
146143
public function testRenderStimulusAction(string $controllerName, ?string $actionName, ?string $eventName, array $parameters, string $expectedString, array $expectedArray)
147144
{
148145
$extension = new StimulusTwigExtension(new StimulusHelper($this->twig));
@@ -218,9 +215,7 @@ public function testAppendStimulusAction()
218215
);
219216
}
220217

221-
/**
222-
* @dataProvider provideRenderStimulusTarget
223-
*/
218+
#[DataProvider('provideRenderStimulusTarget')]
224219
public function testRenderStimulusTarget(string $controllerName, ?string $targetName, string $expectedString, array $expectedArray)
225220
{
226221
$extension = new StimulusTwigExtension(new StimulusHelper($this->twig));
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 <[email protected]>
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)