Skip to content

make test case classes compatible with PHPUnit 10+ #58182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Symfony/Component/Mailer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

7.2
---

* Make `TransportFactoryTestCase` compatible with PHPUnit 10+

7.1
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Component\Mailer\Test;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
use Symfony\Component\Mailer\Exception\IncompleteDsnException;
Expand Down Expand Up @@ -66,6 +67,7 @@
/**
* @dataProvider supportsProvider
*/
#[DataProvider('supportsProvider')]

Check failure on line 70 in src/Symfony/Component/Mailer/Test/TransportFactoryTestCase.php

View workflow job for this annotation

GitHub Actions / Psalm

UndefinedAttributeClass

src/Symfony/Component/Mailer/Test/TransportFactoryTestCase.php:70:7: UndefinedAttributeClass: Attribute class PHPUnit\Framework\Attributes\DataProvider does not exist (see https://psalm.dev/241)
public function testSupports(Dsn $dsn, bool $supports)
{
$factory = $this->getFactory();
Expand All @@ -76,6 +78,7 @@
/**
* @dataProvider createProvider
*/
#[DataProvider('createProvider')]

Check failure on line 81 in src/Symfony/Component/Mailer/Test/TransportFactoryTestCase.php

View workflow job for this annotation

GitHub Actions / Psalm

UndefinedAttributeClass

src/Symfony/Component/Mailer/Test/TransportFactoryTestCase.php:81:7: UndefinedAttributeClass: Attribute class PHPUnit\Framework\Attributes\DataProvider does not exist (see https://psalm.dev/241)
public function testCreate(Dsn $dsn, TransportInterface $transport)
{
$factory = $this->getFactory();
Expand All @@ -89,6 +92,7 @@
/**
* @dataProvider unsupportedSchemeProvider
*/
#[DataProvider('unsupportedSchemeProvider')]

Check failure on line 95 in src/Symfony/Component/Mailer/Test/TransportFactoryTestCase.php

View workflow job for this annotation

GitHub Actions / Psalm

UndefinedAttributeClass

src/Symfony/Component/Mailer/Test/TransportFactoryTestCase.php:95:7: UndefinedAttributeClass: Attribute class PHPUnit\Framework\Attributes\DataProvider does not exist (see https://psalm.dev/241)
public function testUnsupportedSchemeException(Dsn $dsn, ?string $message = null)
{
$factory = $this->getFactory();
Expand All @@ -104,6 +108,7 @@
/**
* @dataProvider incompleteDsnProvider
*/
#[DataProvider('incompleteDsnProvider')]

Check failure on line 111 in src/Symfony/Component/Mailer/Test/TransportFactoryTestCase.php

View workflow job for this annotation

GitHub Actions / Psalm

UndefinedAttributeClass

src/Symfony/Component/Mailer/Test/TransportFactoryTestCase.php:111:7: UndefinedAttributeClass: Attribute class PHPUnit\Framework\Attributes\DataProvider does not exist (see https://psalm.dev/241)
public function testIncompleteDsnException(Dsn $dsn)
{
$factory = $this->getFactory();
Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Component/Notifier/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CHANGELOG
7.2
---

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

6.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Component\Notifier\Test;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Notifier\Exception\IncompleteDsnException;
use Symfony\Component\Notifier\Exception\MissingRequiredOptionException;
Expand Down Expand Up @@ -65,6 +66,7 @@
/**
* @dataProvider supportsProvider
*/
#[DataProvider('supportsProvider')]

Check failure on line 69 in src/Symfony/Component/Notifier/Test/TransportFactoryTestCase.php

View workflow job for this annotation

GitHub Actions / Psalm

UndefinedAttributeClass

src/Symfony/Component/Notifier/Test/TransportFactoryTestCase.php:69:7: UndefinedAttributeClass: Attribute class PHPUnit\Framework\Attributes\DataProvider does not exist (see https://psalm.dev/241)
public function testSupports(bool $expected, string $dsn)
{
$factory = $this->createFactory();
Expand All @@ -75,6 +77,7 @@
/**
* @dataProvider createProvider
*/
#[DataProvider('createProvider')]

Check failure on line 80 in src/Symfony/Component/Notifier/Test/TransportFactoryTestCase.php

View workflow job for this annotation

GitHub Actions / Psalm

UndefinedAttributeClass

src/Symfony/Component/Notifier/Test/TransportFactoryTestCase.php:80:7: UndefinedAttributeClass: Attribute class PHPUnit\Framework\Attributes\DataProvider does not exist (see https://psalm.dev/241)
public function testCreate(string $expected, string $dsn)
{
$factory = $this->createFactory();
Expand All @@ -86,6 +89,7 @@
/**
* @dataProvider unsupportedSchemeProvider
*/
#[DataProvider('unsupportedSchemeProvider')]

Check failure on line 92 in src/Symfony/Component/Notifier/Test/TransportFactoryTestCase.php

View workflow job for this annotation

GitHub Actions / Psalm

UndefinedAttributeClass

src/Symfony/Component/Notifier/Test/TransportFactoryTestCase.php:92:7: UndefinedAttributeClass: Attribute class PHPUnit\Framework\Attributes\DataProvider does not exist (see https://psalm.dev/241)
public function testUnsupportedSchemeException(string $dsn, ?string $message = null)
{
$factory = $this->createFactory();
Expand All @@ -103,6 +107,7 @@
/**
* @dataProvider incompleteDsnProvider
*/
#[DataProvider('incompleteDsnProvider')]

Check failure on line 110 in src/Symfony/Component/Notifier/Test/TransportFactoryTestCase.php

View workflow job for this annotation

GitHub Actions / Psalm

UndefinedAttributeClass

src/Symfony/Component/Notifier/Test/TransportFactoryTestCase.php:110:7: UndefinedAttributeClass: Attribute class PHPUnit\Framework\Attributes\DataProvider does not exist (see https://psalm.dev/241)
public function testIncompleteDsnException(string $dsn, ?string $message = null)
{
$factory = $this->createFactory();
Expand All @@ -120,6 +125,7 @@
/**
* @dataProvider missingRequiredOptionProvider
*/
#[DataProvider('missingRequiredOptionProvider')]

Check failure on line 128 in src/Symfony/Component/Notifier/Test/TransportFactoryTestCase.php

View workflow job for this annotation

GitHub Actions / Psalm

UndefinedAttributeClass

src/Symfony/Component/Notifier/Test/TransportFactoryTestCase.php:128:7: UndefinedAttributeClass: Attribute class PHPUnit\Framework\Attributes\DataProvider does not exist (see https://psalm.dev/241)
public function testMissingRequiredOptionException(string $dsn, ?string $message = null)
{
$factory = $this->createFactory();
Expand Down
5 changes: 5 additions & 0 deletions src/Symfony/Component/Notifier/Test/TransportTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Component\Notifier\Test;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Notifier\Exception\UnsupportedMessageTypeException;
use Symfony\Component\Notifier\Message\MessageInterface;
Expand Down Expand Up @@ -47,6 +48,7 @@
/**
* @dataProvider toStringProvider
*/
#[DataProvider('toStringProvider')]

Check failure on line 51 in src/Symfony/Component/Notifier/Test/TransportTestCase.php

View workflow job for this annotation

GitHub Actions / Psalm

UndefinedAttributeClass

src/Symfony/Component/Notifier/Test/TransportTestCase.php:51:7: UndefinedAttributeClass: Attribute class PHPUnit\Framework\Attributes\DataProvider does not exist (see https://psalm.dev/241)
public function testToString(string $expected, TransportInterface $transport)
{
$this->assertSame($expected, (string) $transport);
Expand All @@ -55,6 +57,7 @@
/**
* @dataProvider supportedMessagesProvider
*/
#[DataProvider('supportedMessagesProvider')]
public function testSupportedMessages(MessageInterface $message, ?TransportInterface $transport = null)
{
$transport ??= $this->createTransport();
Expand All @@ -65,6 +68,7 @@
/**
* @dataProvider unsupportedMessagesProvider
*/
#[DataProvider('unsupportedMessagesProvider')]
public function testUnsupportedMessages(MessageInterface $message, ?TransportInterface $transport = null)
{
$transport ??= $this->createTransport();
Expand All @@ -75,6 +79,7 @@
/**
* @dataProvider unsupportedMessagesProvider
*/
#[DataProvider('unsupportedMessagesProvider')]
public function testUnsupportedMessagesTrowUnsupportedMessageTypeExceptionWhenSend(MessageInterface $message, ?TransportInterface $transport = null)
{
$transport ??= $this->createTransport();
Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Component/Security/Core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CHANGELOG
7.2
---

* Make `AccessDecisionStrategyTestCase` compatible with PHPUnit 10+
* Add `$token` argument to `UserCheckerInterface::checkPostAuth()`
* Deprecate argument `$secret` of `RememberMeToken`
* Deprecate returning an empty string in `UserInterface::getUserIdentifier()`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Component\Security\Core\Test;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\AccessDecisionManager;
Expand All @@ -29,6 +30,7 @@ abstract class AccessDecisionStrategyTestCase extends TestCase
*
* @param VoterInterface[] $voters
*/
#[DataProvider('provideStrategyTests')]
final public function testDecide(AccessDecisionStrategyInterface $strategy, array $voters, bool $expected)
{
$token = $this->createMock(TokenInterface::class);
Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Component/Translation/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CHANGELOG
7.2
---

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Component\Translation\Test;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
Expand Down Expand Up @@ -69,6 +70,7 @@ public static function incompleteDsnProvider(): iterable
/**
* @dataProvider supportsProvider
*/
#[DataProvider('supportsProvider')]
public function testSupports(bool $expected, string $dsn)
{
$factory = $this->createFactory();
Expand All @@ -79,6 +81,7 @@ public function testSupports(bool $expected, string $dsn)
/**
* @dataProvider createProvider
*/
#[DataProvider('createProvider')]
public function testCreate(string $expected, string $dsn)
{
$factory = $this->createFactory();
Expand All @@ -90,6 +93,7 @@ public function testCreate(string $expected, string $dsn)
/**
* @dataProvider unsupportedSchemeProvider
*/
#[DataProvider('unsupportedSchemeProvider')]
public function testUnsupportedSchemeException(string $dsn, ?string $message = null)
{
$factory = $this->createFactory();
Expand All @@ -107,6 +111,7 @@ public function testUnsupportedSchemeException(string $dsn, ?string $message = n
/**
* @dataProvider incompleteDsnProvider
*/
#[DataProvider('incompleteDsnProvider')]
public function testIncompleteDsnException(string $dsn, ?string $message = null)
{
$factory = $this->createFactory();
Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Component/Translation/Test/ProviderTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Component\Translation\Test;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
Expand Down Expand Up @@ -45,6 +46,7 @@ abstract public static function toStringProvider(): iterable;
/**
* @dataProvider toStringProvider
*/
#[DataProvider('toStringProvider')]
public function testToString(ProviderInterface $provider, string $expected)
{
$this->assertSame($expected, (string) $provider);
Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Component/Webhook/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CHANGELOG
7.2
---

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Component\Webhook\Test;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\RemoteEvent\RemoteEvent;
Expand All @@ -24,6 +25,7 @@ abstract class AbstractRequestParserTestCase extends TestCase
/**
* @dataProvider getPayloads
*/
#[DataProvider('getPayloads')]
public function testParse(string $payload, RemoteEvent $expected)
{
$request = $this->createRequest($payload);
Expand Down
5 changes: 5 additions & 0 deletions src/Symfony/Contracts/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

3.6
---

* Make `HttpClientTestCase` and `TranslatorTest` compatible with PHPUnit 10+

3.5
---

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Contracts/Cache/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"minimum-stability": "dev",
"extra": {
"branch-alias": {
"dev-main": "3.5-dev"
"dev-main": "3.6-dev"
},
"thanks": {
"name": "symfony/contracts",
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Contracts/Deprecation/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"minimum-stability": "dev",
"extra": {
"branch-alias": {
"dev-main": "3.5-dev"
"dev-main": "3.6-dev"
},
"thanks": {
"name": "symfony/contracts",
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Contracts/EventDispatcher/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"minimum-stability": "dev",
"extra": {
"branch-alias": {
"dev-main": "3.5-dev"
"dev-main": "3.6-dev"
},
"thanks": {
"name": "symfony/contracts",
Expand Down
4 changes: 4 additions & 0 deletions src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Contracts\HttpClient\Test;

use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use PHPUnit\Framework\TestCase;
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
Expand Down Expand Up @@ -1013,6 +1014,7 @@ public function testNoProxy()
/**
* @requires extension zlib
*/
#[RequiresPhpExtension('zlib')]
public function testAutoEncodingRequest()
{
$client = $this->getHttpClient(__FUNCTION__);
Expand Down Expand Up @@ -1086,6 +1088,7 @@ public function testInformationalResponseStream()
/**
* @requires extension zlib
*/
#[RequiresPhpExtension('zlib')]
public function testUserlandEncodingRequest()
{
$client = $this->getHttpClient(__FUNCTION__);
Expand All @@ -1108,6 +1111,7 @@ public function testUserlandEncodingRequest()
/**
* @requires extension zlib
*/
#[RequiresPhpExtension('zlib')]
public function testGzipBroken()
{
$client = $this->getHttpClient(__FUNCTION__);
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Contracts/HttpClient/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"minimum-stability": "dev",
"extra": {
"branch-alias": {
"dev-main": "3.5-dev"
"dev-main": "3.6-dev"
},
"thanks": {
"name": "symfony/contracts",
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Contracts/Service/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"minimum-stability": "dev",
"extra": {
"branch-alias": {
"dev-main": "3.5-dev"
"dev-main": "3.6-dev"
},
"thanks": {
"name": "symfony/contracts",
Expand Down
Loading
Loading