diff --git a/composer.json b/composer.json index e52628c..f7c340c 100644 --- a/composer.json +++ b/composer.json @@ -26,17 +26,17 @@ } }, "require-dev": { - "symfony/phpunit-bridge": "^7.2", - "symfony/var-dumper": "^7.0", - "symfony/framework-bundle": "^7.0", - "symfony/yaml": "^7.0", - "symfony/translation": "^7.0", + "symfony/phpunit-bridge": "^7.4|^8.0", + "symfony/var-dumper": "^7.0|^8.0", + "symfony/framework-bundle": "^7.0|^8.0", + "symfony/yaml": "^7.0|^8.0", + "symfony/translation": "^7.0|^8.0", "assoconnect/php-quality-config": "^2.2", "phpstan/phpstan-symfony": "^2" }, "require": { "php": "^8.4", - "symfony/cache": "^7.0", + "symfony/cache": "^7.0|^8.0", "symfony/contracts": "^2.5|^3.4", "phpmailer/phpmailer": "^6.6", "thecodingmachine/safe": "^3" diff --git a/tests/Resolver/BounceTypeResolverTest.php b/tests/Resolver/BounceTypeResolverTest.php index d364039..cee38b9 100644 --- a/tests/Resolver/BounceTypeResolverTest.php +++ b/tests/Resolver/BounceTypeResolverTest.php @@ -5,11 +5,12 @@ namespace AssoConnect\SmtpToolbox\Tests\Resolver; use AssoConnect\SmtpToolbox\Resolver\BounceTypeResolver; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class BounceTypeResolverTest extends TestCase { - /** @dataProvider provideBounceReasons */ + #[DataProvider('provideBounceReasons')] public function testResolveBounceMessagesCorrectly(string $expected, string $bounceReason): void { $resolver = new BounceTypeResolver(); diff --git a/tests/Resolver/MxServersResolverTest.php b/tests/Resolver/MxServersResolverTest.php index 884543c..9a971b2 100644 --- a/tests/Resolver/MxServersResolverTest.php +++ b/tests/Resolver/MxServersResolverTest.php @@ -5,6 +5,7 @@ namespace AssoConnect\SmtpToolbox\Tests\Resolver; use AssoConnect\SmtpToolbox\Resolver\MxServersResolver; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use Symfony\Bridge\PhpUnit\DnsMock; use Symfony\Component\Cache\Adapter\ArrayAdapter; @@ -33,10 +34,8 @@ public function testCacheIsUsed(): void self::assertTrue($isHitAfter); } - /** - * @group functional - * @group dns-sensitive - */ + #[Group('functional')] + #[Group('dns-sensitive')] public function testDns(): void { DnsMock::withMockedHosts([ diff --git a/tests/Resolver/ProviderResolverTest.php b/tests/Resolver/ProviderResolverTest.php index b0f88cf..be88ac5 100644 --- a/tests/Resolver/ProviderResolverTest.php +++ b/tests/Resolver/ProviderResolverTest.php @@ -6,13 +6,12 @@ use AssoConnect\SmtpToolbox\Resolver\ProviderResolver; use AssoConnect\SmtpToolbox\Specification\EmailAddressIsFromAProviderSpecification; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class ProviderResolverTest extends TestCase { - /** - * @dataProvider provideAddressesAndProviders - */ + #[DataProvider('provideAddressesAndProviders')] public function testProviderResolverReturnsTheRightProvider(string $address, ?string $provider): void { $resolver = new ProviderResolver( diff --git a/tests/Specification/BounceIsCausedByInactiveUserSpecificationTest.php b/tests/Specification/BounceIsCausedByInactiveUserSpecificationTest.php index 5bbeedf..8766d92 100644 --- a/tests/Specification/BounceIsCausedByInactiveUserSpecificationTest.php +++ b/tests/Specification/BounceIsCausedByInactiveUserSpecificationTest.php @@ -5,11 +5,12 @@ namespace AssoConnect\SmtpToolbox\Tests\Specification; use AssoConnect\SmtpToolbox\Specification\BounceIsCausedByInactiveUserSpecification; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class BounceIsCausedByInactiveUserSpecificationTest extends TestCase { - /** @dataProvider provideMessages */ + #[DataProvider('provideMessages')] public function testSpecificationWorks(string $message, bool $isSpam): void { $spec = new BounceIsCausedByInactiveUserSpecification(); diff --git a/tests/Specification/BounceIsCausedByOverQuotaSpecificationTest.php b/tests/Specification/BounceIsCausedByOverQuotaSpecificationTest.php index 94dc64a..267b927 100644 --- a/tests/Specification/BounceIsCausedByOverQuotaSpecificationTest.php +++ b/tests/Specification/BounceIsCausedByOverQuotaSpecificationTest.php @@ -5,11 +5,12 @@ namespace AssoConnect\SmtpToolbox\Tests\Specification; use AssoConnect\SmtpToolbox\Specification\BounceIsCausedByOverQuotaSpecification; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class BounceIsCausedByOverQuotaSpecificationTest extends TestCase { - /** @dataProvider provideMessages */ + #[DataProvider('provideMessages')] public function testSpecificationWorks(string $message, bool $isSpam): void { $spec = new BounceIsCausedByOverQuotaSpecification(); diff --git a/tests/Specification/BounceIsCausedByUnknownUserSpecificationTest.php b/tests/Specification/BounceIsCausedByUnknownUserSpecificationTest.php index 57c71c5..60e6107 100644 --- a/tests/Specification/BounceIsCausedByUnknownUserSpecificationTest.php +++ b/tests/Specification/BounceIsCausedByUnknownUserSpecificationTest.php @@ -5,11 +5,12 @@ namespace AssoConnect\SmtpToolbox\Tests\Specification; use AssoConnect\SmtpToolbox\Specification\BounceIsCausedByUnknownUserSpecification; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class BounceIsCausedByUnknownUserSpecificationTest extends TestCase { - /** @dataProvider provideMessages */ + #[DataProvider('provideMessages')] public function testSpecificationWorks(string $message, bool $isSpam): void { $spec = new BounceIsCausedByUnknownUserSpecification(); diff --git a/tests/Specification/BounceIsSpamRelatedSpecificationTest.php b/tests/Specification/BounceIsSpamRelatedSpecificationTest.php index 923d9db..6cbab22 100644 --- a/tests/Specification/BounceIsSpamRelatedSpecificationTest.php +++ b/tests/Specification/BounceIsSpamRelatedSpecificationTest.php @@ -6,11 +6,12 @@ use AssoConnect\SmtpToolbox\Resolver\BounceTypeResolver; use AssoConnect\SmtpToolbox\Specification\BounceIsSpamRelatedSpecification; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class BounceIsSpamRelatedSpecificationTest extends TestCase { - /** @dataProvider provideMessages */ + #[DataProvider('provideMessages')] public function testSpecificationWorks(string $message, bool $isSpam): void { $spec = new BounceIsSpamRelatedSpecification(new BounceTypeResolver()); diff --git a/tests/Specification/BounceReasonIsUnknownSpecificationTest.php b/tests/Specification/BounceReasonIsUnknownSpecificationTest.php index c47373f..baf51b7 100644 --- a/tests/Specification/BounceReasonIsUnknownSpecificationTest.php +++ b/tests/Specification/BounceReasonIsUnknownSpecificationTest.php @@ -5,11 +5,12 @@ namespace AssoConnect\SmtpToolbox\Tests\Specification; use AssoConnect\SmtpToolbox\Specification\BounceReasonIsUnknownSpecification; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class BounceReasonIsUnknownSpecificationTest extends TestCase { - /** @dataProvider provideMessages */ + #[DataProvider('provideMessages')] public function testSpecificationWorks(string $message, bool $isSpam): void { $spec = new BounceReasonIsUnknownSpecification(); diff --git a/tests/Specification/EmailAddressIsFromACountrySpecificationTest.php b/tests/Specification/EmailAddressIsFromACountrySpecificationTest.php index aeabce0..fa8bc3c 100644 --- a/tests/Specification/EmailAddressIsFromACountrySpecificationTest.php +++ b/tests/Specification/EmailAddressIsFromACountrySpecificationTest.php @@ -7,11 +7,12 @@ use AssoConnect\SmtpToolbox\Specification\EmailAddressIsFromACountrySpecification; use AssoConnect\SmtpToolbox\Specification\EmailAddressIsFromAProviderSpecification; use AssoConnect\SmtpToolbox\Tests\Resolver\MxServersResolverTestFactory; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class EmailAddressIsFromACountrySpecificationTest extends TestCase { - /** @dataProvider provideEmailAddresses */ + #[DataProvider('provideEmailAddresses')] public function testSpecificationWorks(string $emailAddress, string $country, bool $isSatisfiedBy): void { $spec = new EmailAddressIsFromACountrySpecification( diff --git a/tests/Specification/EmailAddressIsFromAProviderSpecificationTest.php b/tests/Specification/EmailAddressIsFromAProviderSpecificationTest.php index 97d79b1..fb7bcaf 100644 --- a/tests/Specification/EmailAddressIsFromAProviderSpecificationTest.php +++ b/tests/Specification/EmailAddressIsFromAProviderSpecificationTest.php @@ -6,11 +6,12 @@ use AssoConnect\SmtpToolbox\Specification\EmailAddressIsFromAProviderSpecification; use AssoConnect\SmtpToolbox\Tests\Resolver\MxServersResolverTestFactory; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class EmailAddressIsFromAProviderSpecificationTest extends TestCase { - /** @dataProvider provideEmailAddresses */ + #[DataProvider('provideEmailAddresses')] public function testSpecificationWorks(string $emailAddress, string $providerName, bool $isSatisfiedBy): void { $spec = new EmailAddressIsFromAProviderSpecification( diff --git a/tests/Translatable/BounceReasonTranslatableTest.php b/tests/Translatable/BounceReasonTranslatableTest.php index c0ce92e..ef34156 100644 --- a/tests/Translatable/BounceReasonTranslatableTest.php +++ b/tests/Translatable/BounceReasonTranslatableTest.php @@ -5,14 +5,13 @@ namespace AssoConnect\SmtpToolbox\Tests\Translatable; use AssoConnect\SmtpToolbox\Translatable\BounceReasonTranslatable; +use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Contracts\Translation\TranslatorInterface; class BounceReasonTranslatableTest extends KernelTestCase { - /** - * @dataProvider providerTrans - */ + #[DataProvider('providerTrans')] public function testBounceReasonTranslatable(string $reason, string $expectedTranslationKey): void { $translator = static::getContainer()->get(TranslatorInterface::class); diff --git a/tests/Validation/SmtpValidatorTest.php b/tests/Validation/SmtpValidatorTest.php index c85f32e..3fe1034 100644 --- a/tests/Validation/SmtpValidatorTest.php +++ b/tests/Validation/SmtpValidatorTest.php @@ -15,6 +15,7 @@ use AssoConnect\SmtpToolbox\Specification\ExceptionComesFromTemporaryFailureSpecification; use AssoConnect\SmtpToolbox\Tests\Resolver\MxServersResolverTestFactory; use AssoConnect\SmtpToolbox\Validation\SmtpValidator; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Psr\Log\NullLogger; @@ -39,10 +40,10 @@ public function setUp(): void } /** - * @dataProvider provideEmailAddresses * @param class-string $expectedDtoClass * @throws SmtpTemporaryFailureException */ + #[DataProvider('provideEmailAddresses')] public function testClientWorks(string $email, string $expectedDtoClass): void { self::assertInstanceOf($expectedDtoClass, $this->validator->validate($email));