Skip to content

Commit cd38d59

Browse files
committed
[Toolkit] Drop Symfony PHPUnit Bridge in favor of PHPUnit >= 11.0
1 parent ad0621e commit cd38d59

File tree

6 files changed

+41
-53
lines changed

6 files changed

+41
-53
lines changed

src/Toolkit/.gitignore

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
vendor
2-
composer.lock
3-
.phpunit.result.cache
4-
var
5-
.twig-cs-fixer.cache
6-
tests/ui/output
7-
tests/ui/screens
1+
/vendor/
2+
/composer.lock
3+
/phpunit.xml
4+
/.phpunit.cache
5+
/.twig-cs-fixer.cache
6+
7+
/var
8+
/config/reference.php

src/Toolkit/composer.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,9 @@
4646
"zenstruck/console-test": "^1.7",
4747
"symfony/http-client": "^6.4|^7.0|^8.0",
4848
"symfony/stopwatch": "^6.4|^7.0|^8.0",
49-
"symfony/phpunit-bridge": "^7.2|^8.0",
49+
"phpunit/phpunit": "^11.1|^12.0",
5050
"vincentlanglet/twig-cs-fixer": "^3.9",
51-
"spatie/phpunit-snapshot-assertions": "^4.2.17|^5.2.3",
52-
"phpunit/phpunit": "^9.6.22",
51+
"spatie/phpunit-snapshot-assertions": "^5.2.3",
5352
"symfony/ux-icons": "^2.18",
5453
"tales-from-a-dev/twig-tailwind-extra": "^0.4.0"
5554
},
Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
2+
<!-- 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"
77
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"/>
@@ -21,13 +23,18 @@
2123
</testsuite>
2224
</testsuites>
2325

24-
<coverage>
26+
<source
27+
ignoreSuppressionOfDeprecations="true"
28+
ignoreIndirectDeprecations="true"
29+
restrictNotices="true"
30+
restrictWarnings="true"
31+
>
2532
<include>
26-
<directory>./src</directory>
33+
<directory>src</directory>
2734
</include>
28-
</coverage>
2935

30-
<listeners>
31-
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
32-
</listeners>
36+
<deprecationTrigger>
37+
<function>trigger_deprecation</function>
38+
</deprecationTrigger>
39+
</source>
3340
</phpunit>

src/Toolkit/tests/AssertTest.php

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

1212
namespace Symfony\UX\Toolkit\Tests;
1313

14+
use PHPUnit\Framework\Attributes\DataProvider;
1415
use PHPUnit\Framework\TestCase;
1516
use Symfony\UX\Toolkit\Assert;
1617

1718
class AssertTest extends TestCase
1819
{
19-
/**
20-
* @dataProvider provideValidKitNames
21-
*/
20+
#[DataProvider('provideValidKitNames')]
2221
public function testValidKitName(string $name)
2322
{
2423
$this->expectNotToPerformAssertions();
@@ -50,9 +49,7 @@ public static function provideValidKitNames(): \Generator
5049
yield ['my_kit'];
5150
}
5251

53-
/**
54-
* @dataProvider provideInvalidKitNames
55-
*/
52+
#[DataProvider('provideInvalidKitNames')]
5653
public function testInvalidKitName(string $name)
5754
{
5855
$this->expectException(\InvalidArgumentException::class);
@@ -82,9 +79,7 @@ public static function provideInvalidKitNames(): \Generator
8279
yield ['.abc'];
8380
}
8481

85-
/**
86-
* @dataProvider provideValidComponentNames
87-
*/
82+
#[DataProvider('provideValidComponentNames')]
8883
public function testValidComponentName(string $name)
8984
{
9085
$this->expectNotToPerformAssertions();
@@ -106,9 +101,7 @@ public static function provideValidComponentNames(): iterable
106101
yield ['Component123:Sub456'];
107102
}
108103

109-
/**
110-
* @dataProvider provideInvalidComponentNames
111-
*/
104+
#[DataProvider('provideInvalidComponentNames')]
112105
public function testInvalidComponentName(string $name)
113106
{
114107
$this->expectException(\InvalidArgumentException::class);
@@ -143,9 +136,7 @@ public static function provideInvalidComponentNames(): iterable
143136
yield ['123:456'];
144137
}
145138

146-
/**
147-
* @dataProvider provideValidPhpPackageNames
148-
*/
139+
#[DataProvider('provideValidPhpPackageNames')]
149140
public function testValidPhpPackageName(string $name)
150141
{
151142
$this->expectNotToPerformAssertions();
@@ -159,9 +150,7 @@ public static function provideValidPhpPackageNames(): iterable
159150
yield ['tales-from-a-dev/twig-tailwind-extra'];
160151
}
161152

162-
/**
163-
* @dataProvider provideInvalidPhpPackageNames
164-
*/
153+
#[DataProvider('provideInvalidPhpPackageNames')]
165154
public function testInvalidPhpPackageName(string $name)
166155
{
167156
$this->expectException(\InvalidArgumentException::class);
@@ -178,9 +167,7 @@ public static function provideInvalidPhpPackageNames(): iterable
178167
yield ['twig/html-extra/twig'];
179168
}
180169

181-
/**
182-
* @dataProvider provideValidNpmPackageNames
183-
*/
170+
#[DataProvider('provideValidNpmPackageNames')]
184171
public function testValidNpmPackageName(string $name)
185172
{
186173
$this->expectNotToPerformAssertions();
@@ -202,9 +189,7 @@ public static function provideValidNpmPackageNames(): iterable
202189
yield ['~foo'];
203190
}
204191

205-
/**
206-
* @dataProvider provideInvalidNpmPackageNames
207-
*/
192+
#[DataProvider('provideInvalidNpmPackageNames')]
208193
public function testInvalidNpmPackageName(string $name)
209194
{
210195
$this->expectException(\InvalidArgumentException::class);

src/Toolkit/tests/Functional/ComponentsRenderingTest.php

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

1212
namespace Symfony\UX\Toolkit\Tests\Functional;
1313

14+
use PHPUnit\Framework\Attributes\DataProvider;
15+
use PHPUnit\Framework\Attributes\Group;
1416
use Spatie\Snapshots\Drivers\HtmlDriver;
1517
use Spatie\Snapshots\MatchesSnapshots;
1618
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@@ -60,11 +62,8 @@ public static function provideTestComponentRendering(): iterable
6062
}
6163
}
6264

63-
/**
64-
* @dataProvider provideTestComponentRendering
65-
*
66-
* @group skip-on-lowest
67-
*/
65+
#[DataProvider('provideTestComponentRendering')]
66+
#[Group('skip-on-lowest')]
6867
public function testComponentRendering(string $kitName, string $recipeName, string $code)
6968
{
7069
$twig = self::getContainer()->get('twig');

src/Toolkit/tests/Registry/RegistryFactoryTest.php

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

1212
namespace Symfony\UX\Toolkit\Tests\Registry;
1313

14+
use PHPUnit\Framework\Attributes\DataProvider;
1415
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
1516
use Symfony\UX\Toolkit\Registry\GitHubRegistry;
1617
use Symfony\UX\Toolkit\Registry\LocalRegistry;
@@ -31,9 +32,7 @@ public static function provideRegistryNames(): array
3132
];
3233
}
3334

34-
/**
35-
* @dataProvider provideRegistryNames
36-
*/
35+
#[DataProvider('provideRegistryNames')]
3736
public function testCanCreateRegistry(string $registryName, string $expectedRegistryClass)
3837
{
3938
$registryFactory = self::getContainer()->get('ux_toolkit.registry.registry_factory');
@@ -53,9 +52,7 @@ public static function provideInvalidRegistryNames(): array
5352
];
5453
}
5554

56-
/**
57-
* @dataProvider provideInvalidRegistryNames
58-
*/
55+
#[DataProvider('provideInvalidRegistryNames')]
5956
public function testShouldFailIfRegistryIsNotFound(string $registryName)
6057
{
6158
$registryFactory = self::getContainer()->get('ux_toolkit.registry.registry_factory');

0 commit comments

Comments
 (0)