Skip to content

Commit 4973ab1

Browse files
committed
feature #58182 make test case classes compatible with PHPUnit 10+ (xabbuh)
This PR was merged into the 7.2 branch. Discussion ---------- make test case classes compatible with PHPUnit 10+ | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | no | New feature? | yes | Deprecations? | no | Issues | | License | MIT Commits ------- 95a1efc make test case classes compatible with PHPUnit 10+
2 parents fdf4094 + 95a1efc commit 4973ab1

22 files changed

+65
-7
lines changed

src/Symfony/Component/Mailer/CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
7.2
5+
---
6+
7+
* Make `TransportFactoryTestCase` compatible with PHPUnit 10+
8+
49
7.1
510
---
611

src/Symfony/Component/Mailer/Test/TransportFactoryTestCase.php

+5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Mailer\Test;
1313

14+
use PHPUnit\Framework\Attributes\DataProvider;
1415
use PHPUnit\Framework\TestCase;
1516
use Psr\Log\LoggerInterface;
1617
use Symfony\Component\Mailer\Exception\IncompleteDsnException;
@@ -66,6 +67,7 @@ public static function incompleteDsnProvider(): iterable
6667
/**
6768
* @dataProvider supportsProvider
6869
*/
70+
#[DataProvider('supportsProvider')]
6971
public function testSupports(Dsn $dsn, bool $supports)
7072
{
7173
$factory = $this->getFactory();
@@ -76,6 +78,7 @@ public function testSupports(Dsn $dsn, bool $supports)
7678
/**
7779
* @dataProvider createProvider
7880
*/
81+
#[DataProvider('createProvider')]
7982
public function testCreate(Dsn $dsn, TransportInterface $transport)
8083
{
8184
$factory = $this->getFactory();
@@ -89,6 +92,7 @@ public function testCreate(Dsn $dsn, TransportInterface $transport)
8992
/**
9093
* @dataProvider unsupportedSchemeProvider
9194
*/
95+
#[DataProvider('unsupportedSchemeProvider')]
9296
public function testUnsupportedSchemeException(Dsn $dsn, ?string $message = null)
9397
{
9498
$factory = $this->getFactory();
@@ -104,6 +108,7 @@ public function testUnsupportedSchemeException(Dsn $dsn, ?string $message = null
104108
/**
105109
* @dataProvider incompleteDsnProvider
106110
*/
111+
#[DataProvider('incompleteDsnProvider')]
107112
public function testIncompleteDsnException(Dsn $dsn)
108113
{
109114
$factory = $this->getFactory();

src/Symfony/Component/Notifier/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ CHANGELOG
44
7.2
55
---
66

7+
* Make `TransportFactoryTestCase` and `TransportTestCase` compatible with PHPUnit 10+
78
* Add `Desktop` channel
89

910
6.3

src/Symfony/Component/Notifier/Test/TransportFactoryTestCase.php

+6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Notifier\Test;
1313

14+
use PHPUnit\Framework\Attributes\DataProvider;
1415
use PHPUnit\Framework\TestCase;
1516
use Symfony\Component\Notifier\Exception\IncompleteDsnException;
1617
use Symfony\Component\Notifier\Exception\MissingRequiredOptionException;
@@ -65,6 +66,7 @@ public static function missingRequiredOptionProvider(): iterable
6566
/**
6667
* @dataProvider supportsProvider
6768
*/
69+
#[DataProvider('supportsProvider')]
6870
public function testSupports(bool $expected, string $dsn)
6971
{
7072
$factory = $this->createFactory();
@@ -75,6 +77,7 @@ public function testSupports(bool $expected, string $dsn)
7577
/**
7678
* @dataProvider createProvider
7779
*/
80+
#[DataProvider('createProvider')]
7881
public function testCreate(string $expected, string $dsn)
7982
{
8083
$factory = $this->createFactory();
@@ -86,6 +89,7 @@ public function testCreate(string $expected, string $dsn)
8689
/**
8790
* @dataProvider unsupportedSchemeProvider
8891
*/
92+
#[DataProvider('unsupportedSchemeProvider')]
8993
public function testUnsupportedSchemeException(string $dsn, ?string $message = null)
9094
{
9195
$factory = $this->createFactory();
@@ -103,6 +107,7 @@ public function testUnsupportedSchemeException(string $dsn, ?string $message = n
103107
/**
104108
* @dataProvider incompleteDsnProvider
105109
*/
110+
#[DataProvider('incompleteDsnProvider')]
106111
public function testIncompleteDsnException(string $dsn, ?string $message = null)
107112
{
108113
$factory = $this->createFactory();
@@ -120,6 +125,7 @@ public function testIncompleteDsnException(string $dsn, ?string $message = null)
120125
/**
121126
* @dataProvider missingRequiredOptionProvider
122127
*/
128+
#[DataProvider('missingRequiredOptionProvider')]
123129
public function testMissingRequiredOptionException(string $dsn, ?string $message = null)
124130
{
125131
$factory = $this->createFactory();

src/Symfony/Component/Notifier/Test/TransportTestCase.php

+5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Notifier\Test;
1313

14+
use PHPUnit\Framework\Attributes\DataProvider;
1415
use PHPUnit\Framework\TestCase;
1516
use Symfony\Component\Notifier\Exception\UnsupportedMessageTypeException;
1617
use Symfony\Component\Notifier\Message\MessageInterface;
@@ -47,6 +48,7 @@ abstract public static function unsupportedMessagesProvider(): iterable;
4748
/**
4849
* @dataProvider toStringProvider
4950
*/
51+
#[DataProvider('toStringProvider')]
5052
public function testToString(string $expected, TransportInterface $transport)
5153
{
5254
$this->assertSame($expected, (string) $transport);
@@ -55,6 +57,7 @@ public function testToString(string $expected, TransportInterface $transport)
5557
/**
5658
* @dataProvider supportedMessagesProvider
5759
*/
60+
#[DataProvider('supportedMessagesProvider')]
5861
public function testSupportedMessages(MessageInterface $message, ?TransportInterface $transport = null)
5962
{
6063
$transport ??= $this->createTransport();
@@ -65,6 +68,7 @@ public function testSupportedMessages(MessageInterface $message, ?TransportInter
6568
/**
6669
* @dataProvider unsupportedMessagesProvider
6770
*/
71+
#[DataProvider('unsupportedMessagesProvider')]
6872
public function testUnsupportedMessages(MessageInterface $message, ?TransportInterface $transport = null)
6973
{
7074
$transport ??= $this->createTransport();
@@ -75,6 +79,7 @@ public function testUnsupportedMessages(MessageInterface $message, ?TransportInt
7579
/**
7680
* @dataProvider unsupportedMessagesProvider
7781
*/
82+
#[DataProvider('unsupportedMessagesProvider')]
7883
public function testUnsupportedMessagesTrowUnsupportedMessageTypeExceptionWhenSend(MessageInterface $message, ?TransportInterface $transport = null)
7984
{
8085
$transport ??= $this->createTransport();

src/Symfony/Component/Security/Core/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ CHANGELOG
44
7.2
55
---
66

7+
* Make `AccessDecisionStrategyTestCase` compatible with PHPUnit 10+
78
* Add `$token` argument to `UserCheckerInterface::checkPostAuth()`
89
* Deprecate argument `$secret` of `RememberMeToken`
910
* Deprecate returning an empty string in `UserInterface::getUserIdentifier()`

src/Symfony/Component/Security/Core/Test/AccessDecisionStrategyTestCase.php

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Security\Core\Test;
1313

14+
use PHPUnit\Framework\Attributes\DataProvider;
1415
use PHPUnit\Framework\TestCase;
1516
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
1617
use Symfony\Component\Security\Core\Authorization\AccessDecisionManager;
@@ -29,6 +30,7 @@ abstract class AccessDecisionStrategyTestCase extends TestCase
2930
*
3031
* @param VoterInterface[] $voters
3132
*/
33+
#[DataProvider('provideStrategyTests')]
3234
final public function testDecide(AccessDecisionStrategyInterface $strategy, array $voters, bool $expected)
3335
{
3436
$token = $this->createMock(TokenInterface::class);

src/Symfony/Component/Translation/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ CHANGELOG
44
7.2
55
---
66

7+
* Make `ProviderFactoryTestCase` and `ProviderTestCase` compatible with PHPUnit 10+
78
* Add `lint:translations` command
89
* Deprecate passing an escape character to `CsvFileLoader::setCsvControl()`
910

src/Symfony/Component/Translation/Test/ProviderFactoryTestCase.php

+5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Translation\Test;
1313

14+
use PHPUnit\Framework\Attributes\DataProvider;
1415
use PHPUnit\Framework\MockObject\MockObject;
1516
use PHPUnit\Framework\TestCase;
1617
use Psr\Log\LoggerInterface;
@@ -69,6 +70,7 @@ public static function incompleteDsnProvider(): iterable
6970
/**
7071
* @dataProvider supportsProvider
7172
*/
73+
#[DataProvider('supportsProvider')]
7274
public function testSupports(bool $expected, string $dsn)
7375
{
7476
$factory = $this->createFactory();
@@ -79,6 +81,7 @@ public function testSupports(bool $expected, string $dsn)
7981
/**
8082
* @dataProvider createProvider
8183
*/
84+
#[DataProvider('createProvider')]
8285
public function testCreate(string $expected, string $dsn)
8386
{
8487
$factory = $this->createFactory();
@@ -90,6 +93,7 @@ public function testCreate(string $expected, string $dsn)
9093
/**
9194
* @dataProvider unsupportedSchemeProvider
9295
*/
96+
#[DataProvider('unsupportedSchemeProvider')]
9397
public function testUnsupportedSchemeException(string $dsn, ?string $message = null)
9498
{
9599
$factory = $this->createFactory();
@@ -107,6 +111,7 @@ public function testUnsupportedSchemeException(string $dsn, ?string $message = n
107111
/**
108112
* @dataProvider incompleteDsnProvider
109113
*/
114+
#[DataProvider('incompleteDsnProvider')]
110115
public function testIncompleteDsnException(string $dsn, ?string $message = null)
111116
{
112117
$factory = $this->createFactory();

src/Symfony/Component/Translation/Test/ProviderTestCase.php

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Translation\Test;
1313

14+
use PHPUnit\Framework\Attributes\DataProvider;
1415
use PHPUnit\Framework\MockObject\MockObject;
1516
use PHPUnit\Framework\TestCase;
1617
use Psr\Log\LoggerInterface;
@@ -45,6 +46,7 @@ abstract public static function toStringProvider(): iterable;
4546
/**
4647
* @dataProvider toStringProvider
4748
*/
49+
#[DataProvider('toStringProvider')]
4850
public function testToString(ProviderInterface $provider, string $expected)
4951
{
5052
$this->assertSame($expected, (string) $provider);

src/Symfony/Component/Webhook/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ CHANGELOG
44
7.2
55
---
66

7+
* Make `AbstractRequestParserTestCase` compatible with PHPUnit 10+
78
* Add `PayloadSerializerInterface` with implementations to decouple the remote event handling from the Serializer component
89
* Add optional `$request` argument to `RequestParserInterface::createSuccessfulResponse()` and `RequestParserInterface::createRejectedResponse()`
910

src/Symfony/Component/Webhook/Test/AbstractRequestParserTestCase.php

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Webhook\Test;
1313

14+
use PHPUnit\Framework\Attributes\DataProvider;
1415
use PHPUnit\Framework\TestCase;
1516
use Symfony\Component\HttpFoundation\Request;
1617
use Symfony\Component\RemoteEvent\RemoteEvent;
@@ -24,6 +25,7 @@ abstract class AbstractRequestParserTestCase extends TestCase
2425
/**
2526
* @dataProvider getPayloads
2627
*/
28+
#[DataProvider('getPayloads')]
2729
public function testParse(string $payload, RemoteEvent $expected)
2830
{
2931
$request = $this->createRequest($payload);

src/Symfony/Contracts/CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
3.6
5+
---
6+
7+
* Make `HttpClientTestCase` and `TranslatorTest` compatible with PHPUnit 10+
8+
49
3.5
510
---
611

src/Symfony/Contracts/Cache/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"minimum-stability": "dev",
2626
"extra": {
2727
"branch-alias": {
28-
"dev-main": "3.5-dev"
28+
"dev-main": "3.6-dev"
2929
},
3030
"thanks": {
3131
"name": "symfony/contracts",

src/Symfony/Contracts/Deprecation/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"minimum-stability": "dev",
2626
"extra": {
2727
"branch-alias": {
28-
"dev-main": "3.5-dev"
28+
"dev-main": "3.6-dev"
2929
},
3030
"thanks": {
3131
"name": "symfony/contracts",

src/Symfony/Contracts/EventDispatcher/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"minimum-stability": "dev",
2626
"extra": {
2727
"branch-alias": {
28-
"dev-main": "3.5-dev"
28+
"dev-main": "3.6-dev"
2929
},
3030
"thanks": {
3131
"name": "symfony/contracts",

src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Contracts\HttpClient\Test;
1313

14+
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
1415
use PHPUnit\Framework\TestCase;
1516
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
1617
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
@@ -1013,6 +1014,7 @@ public function testNoProxy()
10131014
/**
10141015
* @requires extension zlib
10151016
*/
1017+
#[RequiresPhpExtension('zlib')]
10161018
public function testAutoEncodingRequest()
10171019
{
10181020
$client = $this->getHttpClient(__FUNCTION__);
@@ -1086,6 +1088,7 @@ public function testInformationalResponseStream()
10861088
/**
10871089
* @requires extension zlib
10881090
*/
1091+
#[RequiresPhpExtension('zlib')]
10891092
public function testUserlandEncodingRequest()
10901093
{
10911094
$client = $this->getHttpClient(__FUNCTION__);
@@ -1108,6 +1111,7 @@ public function testUserlandEncodingRequest()
11081111
/**
11091112
* @requires extension zlib
11101113
*/
1114+
#[RequiresPhpExtension('zlib')]
11111115
public function testGzipBroken()
11121116
{
11131117
$client = $this->getHttpClient(__FUNCTION__);

src/Symfony/Contracts/HttpClient/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"minimum-stability": "dev",
2828
"extra": {
2929
"branch-alias": {
30-
"dev-main": "3.5-dev"
30+
"dev-main": "3.6-dev"
3131
},
3232
"thanks": {
3333
"name": "symfony/contracts",

src/Symfony/Contracts/Service/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"minimum-stability": "dev",
3333
"extra": {
3434
"branch-alias": {
35-
"dev-main": "3.5-dev"
35+
"dev-main": "3.6-dev"
3636
},
3737
"thanks": {
3838
"name": "symfony/contracts",

0 commit comments

Comments
 (0)