From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit@debian.org>
Date: Mon, 17 Feb 2025 12:08:34 +0100
Subject: Modernize PHPUnit syntax

---
 Tests/Dbal/AclProviderBenchmarkTest.php                | 5 ++---
 Tests/Domain/AuditLoggerTest.php                       | 4 ++++
 Tests/Domain/DoctrineAclCacheTest.php                  | 2 ++
 Tests/Domain/ObjectIdentityTest.php                    | 2 ++
 Tests/Domain/PermissionGrantingStrategyTest.php        | 2 ++
 Tests/Domain/RoleSecurityIdentityTest.php              | 2 ++
 Tests/Domain/SecurityIdentityRetrievalStrategyTest.php | 3 +++
 Tests/Domain/UserSecurityIdentityTest.php              | 5 ++---
 Tests/Permission/MaskBuilderTest.php                   | 2 ++
 Tests/Voter/AclVoterTest.php                           | 8 ++++++++
 10 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/Tests/Dbal/AclProviderBenchmarkTest.php b/Tests/Dbal/AclProviderBenchmarkTest.php
index 685031a..70a1b97 100644
--- a/Tests/Dbal/AclProviderBenchmarkTest.php
+++ b/Tests/Dbal/AclProviderBenchmarkTest.php
@@ -13,6 +13,7 @@ namespace Symfony\Component\Security\Acl\Tests\Dbal;
 
 use Doctrine\DBAL\Connection;
 use Doctrine\DBAL\DriverManager;
+use PHPUnit\Framework\Attributes\Group;
 use PHPUnit\Framework\TestCase;
 use Symfony\Component\Security\Acl\Dbal\AclProvider;
 use Symfony\Component\Security\Acl\Dbal\Schema;
@@ -52,9 +53,7 @@ class AclProviderBenchmarkTest extends TestCase
         $this->connection = null;
     }
 
-    /**
-     * @group nophpunit11
-     */
+    #[Group('nophpunit11')]
     public function testFindAcls()
     {
         // $this->generateTestData();
diff --git a/Tests/Domain/AuditLoggerTest.php b/Tests/Domain/AuditLoggerTest.php
index 95b1f4a..9f3162b 100644
--- a/Tests/Domain/AuditLoggerTest.php
+++ b/Tests/Domain/AuditLoggerTest.php
@@ -11,6 +11,8 @@
 
 namespace Symfony\Component\Security\Acl\Tests\Domain;
 
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attributes\Group;
 use PHPUnit\Framework\TestCase;
 use Symfony\Component\Security\Acl\Domain\AuditLogger;
 use Symfony\Component\Security\Acl\Tests\Fixtures\SerializableAuditableEntryInterface;
@@ -20,6 +22,8 @@ class AuditLoggerTest extends TestCase
     /**
      * @dataProvider getTestLogData
      */
+    #[DataProvider('getTestLogData')]
+    #[Group('nophpunit11')]
     public function testLogIfNeeded($granting, $audit)
     {
         $logger = $this->getLogger();
diff --git a/Tests/Domain/DoctrineAclCacheTest.php b/Tests/Domain/DoctrineAclCacheTest.php
index 1d2c6a6..036989d 100644
--- a/Tests/Domain/DoctrineAclCacheTest.php
+++ b/Tests/Domain/DoctrineAclCacheTest.php
@@ -12,6 +12,7 @@
 namespace Symfony\Component\Security\Acl\Tests\Domain;
 
 use Doctrine\Common\Cache\Psr6\DoctrineProvider;
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 use Symfony\Component\Cache\Adapter\ArrayAdapter;
 use Symfony\Component\Security\Acl\Domain\Acl;
@@ -27,6 +28,7 @@ class DoctrineAclCacheTest extends TestCase
     /**
      * @dataProvider getEmptyValue
      */
+    #[DataProvider('getEmptyValue')]
     public function testConstructorDoesNotAcceptEmptyPrefix($empty)
     {
         $this->expectException(\InvalidArgumentException::class);
diff --git a/Tests/Domain/ObjectIdentityTest.php b/Tests/Domain/ObjectIdentityTest.php
index 3a86db3..698a3d7 100644
--- a/Tests/Domain/ObjectIdentityTest.php
+++ b/Tests/Domain/ObjectIdentityTest.php
@@ -11,6 +11,7 @@
 
 namespace Symfony\Component\Security\Acl\Tests\Domain
 {
+    use PHPUnit\Framework\Attributes\DataProvider;
     use Symfony\Component\Security\Acl\Domain\ObjectIdentity;
     use Symfony\Component\Security\Acl\Model\DomainObjectInterface;
 
@@ -88,6 +89,7 @@ namespace Symfony\Component\Security\Acl\Tests\Domain
         /**
          * @dataProvider getCompareData
          */
+        #[DataProvider('getCompareData')]
         public function testEquals($oid1, $oid2, $equal)
         {
             if ($equal) {
diff --git a/Tests/Domain/PermissionGrantingStrategyTest.php b/Tests/Domain/PermissionGrantingStrategyTest.php
index d7225e2..6394fee 100644
--- a/Tests/Domain/PermissionGrantingStrategyTest.php
+++ b/Tests/Domain/PermissionGrantingStrategyTest.php
@@ -11,6 +11,7 @@
 
 namespace Symfony\Component\Security\Acl\Tests\Domain;
 
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 use Symfony\Component\Security\Acl\Domain\Acl;
 use Symfony\Component\Security\Acl\Domain\ObjectIdentity;
@@ -142,6 +143,7 @@ class PermissionGrantingStrategyTest extends TestCase
     /**
      * @dataProvider getAllStrategyTests
      */
+    #[DataProvider('getAllStrategyTests')]
     public function testIsGrantedStrategies($maskStrategy, $aceMask, $requiredMask, $result)
     {
         $strategy = new PermissionGrantingStrategy();
diff --git a/Tests/Domain/RoleSecurityIdentityTest.php b/Tests/Domain/RoleSecurityIdentityTest.php
index c82f6c3..6a912d0 100644
--- a/Tests/Domain/RoleSecurityIdentityTest.php
+++ b/Tests/Domain/RoleSecurityIdentityTest.php
@@ -11,6 +11,7 @@
 
 namespace Symfony\Component\Security\Acl\Tests\Domain;
 
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 use Symfony\Component\Security\Acl\Domain\RoleSecurityIdentity;
 use Symfony\Component\Security\Acl\Domain\UserSecurityIdentity;
@@ -28,6 +29,7 @@ class RoleSecurityIdentityTest extends TestCase
     /**
      * @dataProvider getCompareData
      */
+    #[DataProvider('getCompareData')]
     public function testEquals(RoleSecurityIdentity $id1, SecurityIdentityInterface $id2, bool $equal)
     {
         if ($equal) {
diff --git a/Tests/Domain/SecurityIdentityRetrievalStrategyTest.php b/Tests/Domain/SecurityIdentityRetrievalStrategyTest.php
index cc0ed6f..0791198 100644
--- a/Tests/Domain/SecurityIdentityRetrievalStrategyTest.php
+++ b/Tests/Domain/SecurityIdentityRetrievalStrategyTest.php
@@ -11,6 +11,7 @@
 
 namespace Symfony\Component\Security\Acl\Tests\Domain;
 
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 use Symfony\Component\Security\Acl\Domain\RoleSecurityIdentity;
 use Symfony\Component\Security\Acl\Domain\SecurityIdentityRetrievalStrategy;
@@ -29,6 +30,7 @@ class SecurityIdentityRetrievalStrategyTest extends TestCase
     /**
      * @dataProvider getSecurityIdentityRetrievalTests
      */
+    #[DataProvider('getSecurityIdentityRetrievalTests')]
     public function testGetSecurityIdentities($user, array $roles, string $authenticationStatus, array $sids)
     {
         $token = class_exists(NullToken::class) ? new NullToken() : new AnonymousToken('', '');
@@ -74,6 +76,7 @@ class SecurityIdentityRetrievalStrategyTest extends TestCase
      *
      * @dataProvider getDeprecatedSecurityIdentityRetrievalTests
      */
+    #[DataProvider('getDeprecatedSecurityIdentityRetrievalTests')]
     public function testDeprecatedGetSecurityIdentities($user, array $roles, string $authenticationStatus, array $sids)
     {
         if (method_exists(AuthenticationTrustResolverInterface::class, 'isAuthenticated')) {
diff --git a/Tests/Domain/UserSecurityIdentityTest.php b/Tests/Domain/UserSecurityIdentityTest.php
index 6b8d529..a4eee0d 100644
--- a/Tests/Domain/UserSecurityIdentityTest.php
+++ b/Tests/Domain/UserSecurityIdentityTest.php
@@ -11,6 +11,7 @@
 
 namespace Symfony\Component\Security\Acl\Tests\Domain;
 
+use PHPUnit\Framework\Attributes\Group;
 use Symfony\Component\Security\Acl\Domain\RoleSecurityIdentity;
 use Symfony\Component\Security\Acl\Domain\UserSecurityIdentity;
 use Symfony\Component\Security\Acl\Model\SecurityIdentityInterface;
@@ -36,9 +37,7 @@ class UserSecurityIdentityTest extends \PHPUnit\Framework\TestCase
         $this->assertEquals('Acme\DemoBundle\Proxy\__CG__\Symfony\Component\Security\Acl\Tests\Domain\Foo', $id->getClass());
     }
 
-    /**
-     * @group nophpunit11
-     */
+    #[Group('nophpunit11')]
     public function testEquals(UserSecurityIdentity $id1, SecurityIdentityInterface $id2, bool $equal)
     {
         $this->assertSame($equal, $id1->equals($id2));
diff --git a/Tests/Permission/MaskBuilderTest.php b/Tests/Permission/MaskBuilderTest.php
index 9203fb6..4959755 100644
--- a/Tests/Permission/MaskBuilderTest.php
+++ b/Tests/Permission/MaskBuilderTest.php
@@ -11,6 +11,7 @@
 
 namespace Symfony\Component\Security\Acl\Tests\Permission;
 
+use PHPUnit\Framework\Attributes\DataProvider;
 use Symfony\Component\Security\Acl\Permission\MaskBuilder;
 
 class MaskBuilderTest extends \PHPUnit\Framework\TestCase
@@ -18,6 +19,7 @@ class MaskBuilderTest extends \PHPUnit\Framework\TestCase
     /**
      * @dataProvider getInvalidConstructorData
      */
+    #[DataProvider('getInvalidConstructorData')]
     public function testConstructorWithNonInteger($invalidMask)
     {
         $this->expectException(\InvalidArgumentException::class);
diff --git a/Tests/Voter/AclVoterTest.php b/Tests/Voter/AclVoterTest.php
index c652ca4..fc45b67 100644
--- a/Tests/Voter/AclVoterTest.php
+++ b/Tests/Voter/AclVoterTest.php
@@ -11,6 +11,7 @@
 
 namespace Symfony\Component\Security\Acl\Tests\Voter;
 
+use PHPUnit\Framework\Attributes\DataProvider;
 use PHPUnit\Framework\TestCase;
 use Symfony\Component\Security\Acl\Domain\ObjectIdentity;
 use Symfony\Component\Security\Acl\Domain\RoleSecurityIdentity;
@@ -32,6 +33,7 @@ class AclVoterTest extends TestCase
     /**
      * @dataProvider getSupportsAttributeTests
      */
+    #[DataProvider('getSupportsAttributeTests')]
     public function testSupportsAttribute($attribute, $supported)
     {
         [$voter, , $permissionMap] = $this->getVoter(true, false);
@@ -49,6 +51,7 @@ class AclVoterTest extends TestCase
     /**
      * @dataProvider getSupportsAttributeNonStringTests
      */
+    #[DataProvider('getSupportsAttributeNonStringTests')]
     public function testSupportsAttributeNonString($attribute)
     {
         [$voter] = $this->getVoter(true, false);
@@ -77,6 +80,7 @@ class AclVoterTest extends TestCase
     /**
      * @dataProvider getSupportsClassTests
      */
+    #[DataProvider('getSupportsClassTests')]
     public function testSupportsClass($class)
     {
         [$voter] = $this->getVoter();
@@ -108,6 +112,7 @@ class AclVoterTest extends TestCase
     /**
      * @dataProvider getTrueFalseTests
      */
+    #[DataProvider('getTrueFalseTests')]
     public function testVoteWhenNoObjectIsPassed($allowIfObjectIdentityUnavailable)
     {
         [$voter, , $permissionMap] = $this->getVoter($allowIfObjectIdentityUnavailable);
@@ -129,6 +134,7 @@ class AclVoterTest extends TestCase
     /**
      * @dataProvider getTrueFalseTests
      */
+    #[DataProvider('getTrueFalseTests')]
     public function testVoteWhenOidStrategyReturnsNull($allowIfUnavailable)
     {
         [$voter, , $permissionMap, $oidStrategy] = $this->getVoter($allowIfUnavailable);
@@ -193,6 +199,7 @@ class AclVoterTest extends TestCase
     /**
      * @dataProvider getTrueFalseTests
      */
+    #[DataProvider('getTrueFalseTests')]
     public function testVoteGrantsAccess($grant)
     {
         [$voter, $provider, $permissionMap, $oidStrategy, $sidStrategy] = $this->getVoter();
@@ -282,6 +289,7 @@ class AclVoterTest extends TestCase
     /**
      * @dataProvider getTrueFalseTests
      */
+    #[DataProvider('getTrueFalseTests')]
     public function testVoteGrantsFieldAccess($grant)
     {
         [$voter, $provider, $permissionMap, $oidStrategy, $sidStrategy] = $this->getVoter();
