From 10c0eb52899180c3b67674e571a8d332a90ead8f Mon Sep 17 00:00:00 2001 From: "Eric Richer eric.richer@vistoconsulting.com" Date: Wed, 7 Aug 2024 14:38:34 -0400 Subject: [PATCH] Added support for phpunit v11. Fixed phpunit deprecations Signed-off-by: Eric Richer eric.richer@vistoconsulting.com --- composer.json | 2 +- renovate.json | 11 +++----- .../AssertionPluginManagerFactoryTest.php | 7 +++-- test/Assertion/AssertionPluginManagerTest.php | 5 ++-- test/Assertion/AssertionSetTest.php | 10 +++---- .../DummyAuthorizationServiceClass.php | 2 +- test/ConfigProviderTest.php | 5 ++-- test/ModuleTest.php | 5 ++-- .../ModuleOptionsFactoryTest.php | 7 +++-- test/Options/ModuleOptionsTest.php | 5 ++-- test/Rbac/RbacTest.php | 27 ++----------------- .../InMemoryRoleProviderFactoryTest.php | 7 +++-- test/Role/InMemoryRoleProviderTest.php | 5 ++-- ...bjectRepositoryRoleProviderFactoryTest.php | 9 +++---- .../Role/ObjectRepositoryRoleProviderTest.php | 10 +++---- test/Role/RoleTest.php | 24 ++--------------- .../AuthorizationServiceAwareTraitTest.php | 3 +++ ...thorizationServiceDelegatorFactoryTest.php | 4 ++- .../AuthorizationServiceFactoryTest.php | 7 +++-- test/Service/AuthorizationServiceTest.php | 10 +++---- .../RoleServiceFactoryTest.php | 7 +++-- test/Service/RoleServiceTest.php | 5 ++-- 22 files changed, 59 insertions(+), 118 deletions(-) rename test/{Container => Assertion}/AssertionPluginManagerFactoryTest.php (92%) rename test/{Service => Asset}/DummyAuthorizationServiceClass.php (97%) rename test/{Container => Options}/ModuleOptionsFactoryTest.php (91%) rename test/{Container => Role}/InMemoryRoleProviderFactoryTest.php (93%) rename test/{Container => Role}/ObjectRepositoryRoleProviderFactoryTest.php (95%) rename test/{Container => Service}/AuthorizationServiceFactoryTest.php (94%) rename test/{Container => Service}/RoleServiceFactoryTest.php (94%) diff --git a/composer.json b/composer.json index 22882fa..f1e7b9b 100644 --- a/composer.json +++ b/composer.json @@ -46,7 +46,7 @@ }, "require-dev": { "malukenho/docheader": "^1.0.0", - "phpunit/phpunit": "^10.0", + "phpunit/phpunit": "^10.0 || ^11.0", "phpspec/prophecy": "^1.10", "phpspec/prophecy-phpunit": "^2.0", "friendsofphp/php-cs-fixer": "^3.43", diff --git a/renovate.json b/renovate.json index 8f151a8..328a80f 100644 --- a/renovate.json +++ b/renovate.json @@ -3,11 +3,8 @@ "extends": [ "config:recommended" ], - "baseBranches": ["master", "2.x"], - "packageRules": [ - { - "matchPackageNames": ["phpunit/phpunit"], - "allowedVersions": "<11.0" - } - ] + "major": { + "dependencyDashboardApproval": true + }, + "baseBranches": ["master", "2.x"] } diff --git a/test/Container/AssertionPluginManagerFactoryTest.php b/test/Assertion/AssertionPluginManagerFactoryTest.php similarity index 92% rename from test/Container/AssertionPluginManagerFactoryTest.php rename to test/Assertion/AssertionPluginManagerFactoryTest.php index 3e1824a..dc04eef 100644 --- a/test/Container/AssertionPluginManagerFactoryTest.php +++ b/test/Assertion/AssertionPluginManagerFactoryTest.php @@ -19,18 +19,17 @@ declare(strict_types=1); -namespace LmcRbacTest\Container; +namespace LmcRbacTest\Assertion; use Laminas\ServiceManager\ServiceManager; use Lmc\Rbac\Assertion\AssertionContainer; use Lmc\Rbac\Assertion\AssertionContainerFactory; use Lmc\Rbac\Assertion\AssertionPluginManager; use Lmc\Rbac\Assertion\AssertionPluginManagerFactory; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; -/** - * @covers \Lmc\Rbac\Assertion\AssertionPluginManagerFactory - */ +#[CoversClass('\Lmc\Rbac\Assertion\AssertionPluginManagerFactory')] class AssertionPluginManagerFactoryTest extends TestCase { public function testFactory(): void diff --git a/test/Assertion/AssertionPluginManagerTest.php b/test/Assertion/AssertionPluginManagerTest.php index 79b9368..2fe90f4 100644 --- a/test/Assertion/AssertionPluginManagerTest.php +++ b/test/Assertion/AssertionPluginManagerTest.php @@ -27,11 +27,10 @@ use Lmc\Rbac\Assertion\AssertionInterface; use Lmc\Rbac\Assertion\AssertionPluginManager; use LmcRbacTest\Asset\SimpleAssertion; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; -/** - * @covers \Lmc\Rbac\Assertion\AssertionPluginManager - */ +#[CoversClass('\Lmc\Rbac\Assertion\AssertionPluginManager')] class AssertionPluginManagerTest extends TestCase { public function testValidationOfPluginSucceedsIfAssertionInterfaceIsImplemented() diff --git a/test/Assertion/AssertionSetTest.php b/test/Assertion/AssertionSetTest.php index 6d4cbf2..7658599 100644 --- a/test/Assertion/AssertionSetTest.php +++ b/test/Assertion/AssertionSetTest.php @@ -28,11 +28,11 @@ use Lmc\Rbac\Exception\InvalidArgumentException; use Lmc\Rbac\Identity\IdentityInterface; use LmcRbacTest\Asset\SimpleAssertion; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; -/** - * @covers \Lmc\Rbac\Assertion\AssertionSet - */ +#[CoversClass('\Lmc\Rbac\Assertion\AssertionSet')] class AssertionSetTest extends TestCase { public function testImplementsAssertionInterface() @@ -222,9 +222,7 @@ public function testThrowExceptionForInvalidAssertion() $this->assertTrue($assertionSet->assert('permission')); } - /** - * @dataProvider dpMatrix - */ + #[DataProvider('dpMatrix')] public function testMatrix(array $assertions, bool $expectedResult, array $assertionCalledCount) { $assertionContainer = $this->getMockBuilder(AssertionPluginManagerInterface::class)->getMock(); diff --git a/test/Service/DummyAuthorizationServiceClass.php b/test/Asset/DummyAuthorizationServiceClass.php similarity index 97% rename from test/Service/DummyAuthorizationServiceClass.php rename to test/Asset/DummyAuthorizationServiceClass.php index 3054f2e..3f00084 100644 --- a/test/Service/DummyAuthorizationServiceClass.php +++ b/test/Asset/DummyAuthorizationServiceClass.php @@ -16,7 +16,7 @@ * and is licensed under the MIT license. */ -namespace LmcRbacTest\Service; +namespace LmcRbacTest\Asset; /** * @author Eric Richer diff --git a/test/ConfigProviderTest.php b/test/ConfigProviderTest.php index fa469ba..886ffc9 100644 --- a/test/ConfigProviderTest.php +++ b/test/ConfigProviderTest.php @@ -22,11 +22,10 @@ namespace LmcRbacTest; use Lmc\Rbac\ConfigProvider; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; -/** - * @covers \Lmc\Rbac\ConfigProvider - */ +#[CoversClass('Lmc\Rbac\ConfigProvider')] class ConfigProviderTest extends TestCase { public function testProvidesExpectedConfiguration() diff --git a/test/ModuleTest.php b/test/ModuleTest.php index 40297cb..4df59bc 100644 --- a/test/ModuleTest.php +++ b/test/ModuleTest.php @@ -23,11 +23,10 @@ use Lmc\Rbac\ConfigProvider; use Lmc\Rbac\Module; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; -/** - * @covers \Lmc\Rbac\Module - */ +#[CoversClass('\Lmc\Rbac\Module')] class ModuleTest extends TestCase { public function testProvidesExpectedConfiguration() diff --git a/test/Container/ModuleOptionsFactoryTest.php b/test/Options/ModuleOptionsFactoryTest.php similarity index 91% rename from test/Container/ModuleOptionsFactoryTest.php rename to test/Options/ModuleOptionsFactoryTest.php index 5ceafb7..7886075 100644 --- a/test/Container/ModuleOptionsFactoryTest.php +++ b/test/Options/ModuleOptionsFactoryTest.php @@ -19,16 +19,15 @@ declare(strict_types=1); -namespace LmcRbacTest\Container; +namespace LmcRbacTest\Options; use Laminas\ServiceManager\ServiceManager; use Lmc\Rbac\Options\ModuleOptionsFactory; use Lmc\Rbac\Options\ModuleOptions; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; -/** - * @covers \Lmc\Rbac\Options\ModuleOptionsFactory - */ +#[CoversClass('\Lmc\Rbac\Options\ModuleOptionsFactory')] class ModuleOptionsFactoryTest extends TestCase { public function testFactory(): void diff --git a/test/Options/ModuleOptionsTest.php b/test/Options/ModuleOptionsTest.php index 89b7810..523499e 100644 --- a/test/Options/ModuleOptionsTest.php +++ b/test/Options/ModuleOptionsTest.php @@ -22,11 +22,10 @@ namespace LmcRbacTest\Options; use Lmc\Rbac\Options\ModuleOptions; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; -/** - * @covers \Lmc\Rbac\Options\ModuleOptions - */ +#[CoversClass('\Lmc\Rbac\Options\ModuleOptions')] class ModuleOptionsTest extends TestCase { public function testAssertModuleDefaultOptions(): void diff --git a/test/Rbac/RbacTest.php b/test/Rbac/RbacTest.php index 6e5740f..f6fadf1 100644 --- a/test/Rbac/RbacTest.php +++ b/test/Rbac/RbacTest.php @@ -23,17 +23,12 @@ use Lmc\Rbac\Rbac; use Lmc\Rbac\Role\Role; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; -/** - * @covers \Lmc\Rbac\Rbac - * @group Coverage - */ +#[CoversClass('\Lmc\Rbac\Rbac')] class RbacTest extends TestCase { - /** - * @covers \Lmc\Rbac\Rbac::isGranted - */ public function testCanConvertSingleRole(): void { $role = new Role('Foo'); @@ -44,18 +39,12 @@ public function testCanConvertSingleRole(): void $this->assertTrue($rbac->isGranted($role, 'permission')); } - /** - * @covers \Lmc\Rbac\Rbac::isGranted - */ public function testCanUseEmptyArray(): void { $rbac = new Rbac(); $this->assertFalse($rbac->isGranted([], 'permission')); } - /** - * @covers \Lmc\Rbac\Rbac::isGranted - */ public function testCanCheckMultipleRolesWithMatchingPermission(): void { $role1 = new Role('Foo'); @@ -69,9 +58,6 @@ public function testCanCheckMultipleRolesWithMatchingPermission(): void $this->assertTrue($rbac->isGranted($roles, 'permission')); } - /** - * @covers \Lmc\Rbac\Rbac::isGranted - */ public function testReturnFalseIfNoRoleHasPermission(): void { $role1 = new Role('Foo'); @@ -83,9 +69,6 @@ public function testReturnFalseIfNoRoleHasPermission(): void $this->assertFalse($rbac->isGranted($roles, 'permission')); } - /** - * @covers \Lmc\Rbac\Rbac::isGranted - */ public function testCanCheckHierarchicalRole(): void { $childRole = new Role('Bar'); @@ -99,9 +82,6 @@ public function testCanCheckHierarchicalRole(): void $this->assertTrue($rbac->isGranted($parentRole, 'permission')); } - /** - * @covers \Lmc\Rbac\Rbac::isGranted - */ public function testReturnFalseIfNoHierarchicalRoleHasPermission(): void { $childRole = new Role('Bar'); @@ -114,9 +94,6 @@ public function testReturnFalseIfNoHierarchicalRoleHasPermission(): void $this->assertFalse($rbac->isGranted($parentRole, 'permission')); } - /** - * @covers \Lmc\Rbac\Rbac::isGranted - */ public function testCanCheckTraversableAsRolesList(): void { $role1 = new Role('Foo'); diff --git a/test/Container/InMemoryRoleProviderFactoryTest.php b/test/Role/InMemoryRoleProviderFactoryTest.php similarity index 93% rename from test/Container/InMemoryRoleProviderFactoryTest.php rename to test/Role/InMemoryRoleProviderFactoryTest.php index 8e3a8e9..888c4bc 100644 --- a/test/Container/InMemoryRoleProviderFactoryTest.php +++ b/test/Role/InMemoryRoleProviderFactoryTest.php @@ -19,17 +19,16 @@ declare(strict_types=1); -namespace LmcRbacTest\Container; +namespace LmcRbacTest\Role; use Laminas\ServiceManager\ServiceManager; use Lmc\Rbac\Role\InMemoryRoleProviderFactory; use Lmc\Rbac\Options\ModuleOptions; use Lmc\Rbac\Role\InMemoryRoleProvider; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; -/** - * @covers \Lmc\Rbac\Role\InMemoryRoleProviderFactory - */ +#[CoversClass('\Lmc\Rbac\Role\InMemoryRoleProviderFactory')] class InMemoryRoleProviderFactoryTest extends TestCase { public function testFactoryUsingObjectRepository(): void diff --git a/test/Role/InMemoryRoleProviderTest.php b/test/Role/InMemoryRoleProviderTest.php index e2d9ba5..c58a925 100644 --- a/test/Role/InMemoryRoleProviderTest.php +++ b/test/Role/InMemoryRoleProviderTest.php @@ -23,11 +23,10 @@ use Lmc\Rbac\Role\InMemoryRoleProvider; use Lmc\Rbac\Role\RoleInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; -/** - * @covers \Lmc\Rbac\Role\InMemoryRoleProvider - */ +#[CoversClass('\Lmc\Rbac\Role\InMemoryRoleProvider')] class InMemoryRoleProviderTest extends TestCase { public function testInMemoryProvider(): void diff --git a/test/Container/ObjectRepositoryRoleProviderFactoryTest.php b/test/Role/ObjectRepositoryRoleProviderFactoryTest.php similarity index 95% rename from test/Container/ObjectRepositoryRoleProviderFactoryTest.php rename to test/Role/ObjectRepositoryRoleProviderFactoryTest.php index fc9e976..88048cb 100644 --- a/test/Container/ObjectRepositoryRoleProviderFactoryTest.php +++ b/test/Role/ObjectRepositoryRoleProviderFactoryTest.php @@ -19,7 +19,7 @@ declare(strict_types=1); -namespace LmcRbacTest\Container; +namespace LmcRbacTest\Role; use Doctrine\Persistence\ObjectManager; use Doctrine\Persistence\ObjectRepository; @@ -28,11 +28,10 @@ use Lmc\Rbac\Exception\RuntimeException; use Lmc\Rbac\Options\ModuleOptions; use Lmc\Rbac\Role\ObjectRepositoryRoleProvider; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; -/** - * @covers \Lmc\Rbac\Role\ObjectRepositoryRoleProviderFactory - */ +#[CoversClass('\Lmc\Rbac\Role\ObjectRepositoryRoleProviderFactory')] class ObjectRepositoryRoleProviderFactoryTest extends TestCase { public function testFactoryUsingObjectRepository(): void @@ -68,7 +67,7 @@ public function testFactoryUsingObjectManager(): void $objectManager->expects($this->once()) ->method('getRepository') ->with('Role') - ->will($this->returnValue($this->getMockBuilder(ObjectRepository::class)->getMock())); + ->willReturn($this->getMockBuilder(ObjectRepository::class)->getMock()); $container->setService('ObjectManager', $objectManager); diff --git a/test/Role/ObjectRepositoryRoleProviderTest.php b/test/Role/ObjectRepositoryRoleProviderTest.php index c9a9a50..f7eaff3 100644 --- a/test/Role/ObjectRepositoryRoleProviderTest.php +++ b/test/Role/ObjectRepositoryRoleProviderTest.php @@ -30,11 +30,11 @@ use Lmc\Rbac\Role\ObjectRepositoryRoleProvider; use Lmc\Rbac\Role\Role; use Lmc\Rbac\Role\RoleInterface; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; -/** - * @covers \Lmc\Rbac\Role\ObjectRepositoryRoleProvider - */ +#[CoversClass('\Lmc\Rbac\Role\ObjectRepositoryRoleProvider')] class ObjectRepositoryRoleProviderTest extends TestCase { @@ -113,9 +113,7 @@ public function testThrowExceptionIfAskedRoleIsNotFound(): void $provider->getRoles(['guest', 'admin', 'member']); } - /** - * @dataProvider roleProvider - */ + #[DataProvider('roleProvider')] public function testObjectRepositoryProviderForFlatRole(array $rolesConfig, array $rolesToCheck) { $objectManager = $this->getObjectManager(); diff --git a/test/Role/RoleTest.php b/test/Role/RoleTest.php index 5795c87..4cc1daa 100644 --- a/test/Role/RoleTest.php +++ b/test/Role/RoleTest.php @@ -23,12 +23,10 @@ use Lmc\Rbac\Role\Role; use Lmc\Rbac\Role\RoleInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; -/** - * @covers \Lmc\Rbac\Role\Role - * @group Coverage - */ +#[CoversClass('\Lmc\Rbac\Role\Role')] class RoleTest extends TestCase { public function testSetNameByConstructor(): void @@ -37,9 +35,6 @@ public function testSetNameByConstructor(): void $this->assertEquals('phpIsHell', $role->getName()); } - /** - * @covers \Lmc\Rbac\Role\Role::addPermission - */ public function testRoleCanAddPermission(): void { $role = new Role('php'); @@ -52,9 +47,6 @@ public function testRoleCanAddPermission(): void $this->assertTrue($role->hasPermission('delete')); } - /** - * @covers \Lmc\Rbac\Role\Role::getPermissions - */ public function testRoleCanGetPermissions(): void { $role = new Role('php'); @@ -69,9 +61,6 @@ public function testRoleCanGetPermissions(): void $this->assertEquals($expectedPermissions, $role->getPermissions()); } - /** - * @covers \Lmc\Rbac\Role\Role::hasPermission - */ public function testHasPermission(): void { $role = new Role('php'); @@ -87,9 +76,6 @@ public function testHasPermission(): void } - /** - * @covers \Lmc\Rbac\Role\Role::addChild - */ public function testCanAddChild(): void { $role = new Role('role'); @@ -100,9 +86,6 @@ public function testCanAddChild(): void $this->assertCount(1, $role->getChildren()); } - /** - * @covers \Lmc\Rbac\Role\Role::hasChildren - */ public function testHasChildren(): void { $role = new Role('role'); @@ -114,9 +97,6 @@ public function testHasChildren(): void $this->assertTrue($role->hasChildren()); } - /** - * @covers \Lmc\Rbac\Role\Role::getChildren - */ public function testCanGetChildren(): void { $role = new Role('role'); diff --git a/test/Service/AuthorizationServiceAwareTraitTest.php b/test/Service/AuthorizationServiceAwareTraitTest.php index a466a62..3dde18b 100644 --- a/test/Service/AuthorizationServiceAwareTraitTest.php +++ b/test/Service/AuthorizationServiceAwareTraitTest.php @@ -23,8 +23,11 @@ */ use Lmc\Rbac\Service\AuthorizationServiceInterface; +use LmcRbacTest\Asset\DummyAuthorizationServiceClass; +use PHPUnit\Framework\Attributes\CoversTrait; use PHPUnit\Framework\TestCase; +#[CoversTrait('Lmc\Rbac\Service\AuthorizationServiceAwareTrait')] class AuthorizationServiceAwareTraitTest extends TestCase { public function testAuthorizationServiceAwareTrait() diff --git a/test/Service/AuthorizationServiceDelegatorFactoryTest.php b/test/Service/AuthorizationServiceDelegatorFactoryTest.php index 94d985a..bb6829f 100644 --- a/test/Service/AuthorizationServiceDelegatorFactoryTest.php +++ b/test/Service/AuthorizationServiceDelegatorFactoryTest.php @@ -23,13 +23,15 @@ */ use Laminas\ServiceManager\Exception\ServiceNotCreatedException; -use Laminas\ServiceManager\ServiceManager; use Lmc\Rbac\Service\AuthorizationServiceDelegatorFactory; use Lmc\Rbac\Service\AuthorizationServiceInterface; +use LmcRbacTest\Asset\DummyAuthorizationServiceClass; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait; use Psr\Container\ContainerInterface; +#[CoversClass('\Lmc\Rbac\Service\AuthorizationServiceDelegatorFactory')] class AuthorizationServiceDelegatorFactoryTest extends TestCase { use ProphecyTrait; diff --git a/test/Container/AuthorizationServiceFactoryTest.php b/test/Service/AuthorizationServiceFactoryTest.php similarity index 94% rename from test/Container/AuthorizationServiceFactoryTest.php rename to test/Service/AuthorizationServiceFactoryTest.php index 2c8cc3d..7009448 100644 --- a/test/Container/AuthorizationServiceFactoryTest.php +++ b/test/Service/AuthorizationServiceFactoryTest.php @@ -19,7 +19,7 @@ declare(strict_types=1); -namespace LmcRbacTest\Container; +namespace LmcRbacTest\Service; use Lmc\Rbac\Assertion\AssertionContainerInterface; use Lmc\Rbac\Assertion\AssertionPluginManager; @@ -29,13 +29,12 @@ use Lmc\Rbac\Rbac; use Lmc\Rbac\Service\AuthorizationService; use Lmc\Rbac\Service\RoleServiceInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait; use Psr\Container\ContainerInterface; -/** - * @covers \Lmc\Rbac\Service\AuthorizationServiceFactory - */ +#[CoversClass('\Lmc\Rbac\Service\AuthorizationServiceFactory')] class AuthorizationServiceFactoryTest extends TestCase { use ProphecyTrait; diff --git a/test/Service/AuthorizationServiceTest.php b/test/Service/AuthorizationServiceTest.php index 01666e5..e9258c7 100644 --- a/test/Service/AuthorizationServiceTest.php +++ b/test/Service/AuthorizationServiceTest.php @@ -38,11 +38,11 @@ use Lmc\Rbac\Service\RoleServiceInterface; use LmcRbacTest\Asset\Identity; use LmcRbacTest\Asset\SimpleAssertion; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; -/** - * @covers \Lmc\Rbac\Service\AuthorizationService - */ +#[CoversClass('Lmc\Rbac\Service\AuthorizationService')] class AuthorizationServiceTest extends TestCase { public static function grantedProvider(): array @@ -157,9 +157,7 @@ public static function grantedProvider(): array ]; } - /** - * @dataProvider grantedProvider - */ + #[DataProvider('grantedProvider')] public function testGranted($role, $permission, $context, bool $isGranted, array $assertions = []): void { $roleConfig = [ diff --git a/test/Container/RoleServiceFactoryTest.php b/test/Service/RoleServiceFactoryTest.php similarity index 94% rename from test/Container/RoleServiceFactoryTest.php rename to test/Service/RoleServiceFactoryTest.php index 38333c4..765c7f0 100644 --- a/test/Container/RoleServiceFactoryTest.php +++ b/test/Service/RoleServiceFactoryTest.php @@ -19,18 +19,17 @@ declare(strict_types=1); -namespace LmcRbacTest\Container; +namespace LmcRbacTest\Service; use Laminas\ServiceManager\ServiceManager; use Lmc\Rbac\Options\ModuleOptions; use Lmc\Rbac\Role\InMemoryRoleProvider; use Lmc\Rbac\Service\RoleService; use Lmc\Rbac\Service\RoleServiceFactory; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; -/** - * @covers \Lmc\Rbac\Service\RoleServiceFactory - */ +#[CoversClass('\Lmc\Rbac\Service\RoleServiceFactory')] class RoleServiceFactoryTest extends TestCase { public function testCanCreateRoleService(): void diff --git a/test/Service/RoleServiceTest.php b/test/Service/RoleServiceTest.php index 46f4157..a2561fd 100644 --- a/test/Service/RoleServiceTest.php +++ b/test/Service/RoleServiceTest.php @@ -28,13 +28,12 @@ use Lmc\Rbac\Role\RoleProviderInterface; use Lmc\Rbac\Service\RoleService; use LmcRbacTest\Asset\Identity; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Prophecy\Argument; use Prophecy\PhpUnit\ProphecyTrait; -/** - * @covers \Lmc\Rbac\Service\RoleService - */ +#[CoversClass('\Lmc\Rbac\Service\RoleService')] class RoleServiceTest extends TestCase { use ProphecyTrait;