From cadeced4d4d637a8e7466350908c5d02c74c85ab Mon Sep 17 00:00:00 2001 From: "Eric Richer eric.richer@vistoconsulting.com" Date: Fri, 16 Aug 2024 11:14:17 -0400 Subject: [PATCH] Replaced referencs to Laminas\Permission --- src/Role/RoleProviderInterface.php | 1 - src/Role/TraversalStrategyInterface.php | 2 +- src/Service/RoleService.php | 3 +-- tests/Service/RoleServiceTest.php | 20 +++++++++++++++++--- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/Role/RoleProviderInterface.php b/src/Role/RoleProviderInterface.php index cfd3e84b..af588a3c 100644 --- a/src/Role/RoleProviderInterface.php +++ b/src/Role/RoleProviderInterface.php @@ -18,7 +18,6 @@ namespace LmcRbacMvc\Role; -use Laminas\Permissions\Rbac\RoleInterface; use Lmc\Rbac\Role\RoleProviderInterface as BaseRoleProviderInterface; /** diff --git a/src/Role/TraversalStrategyInterface.php b/src/Role/TraversalStrategyInterface.php index 6b71d998..add01474 100644 --- a/src/Role/TraversalStrategyInterface.php +++ b/src/Role/TraversalStrategyInterface.php @@ -18,7 +18,7 @@ namespace LmcRbacMvc\Role; -use Laminas\Permissions\Rbac\RoleInterface; +use Lmc\Rbac\Role\RoleInterface; use Traversable; /** diff --git a/src/Service/RoleService.php b/src/Service/RoleService.php index 2ad59cf3..6bd7eedc 100644 --- a/src/Service/RoleService.php +++ b/src/Service/RoleService.php @@ -18,13 +18,12 @@ namespace LmcRbacMvc\Service; -use Laminas\Permissions\Rbac\RoleInterface; +use Lmc\Rbac\Role\RoleInterface; use Lmc\Rbac\Service\RoleServiceInterface; use Traversable; use Lmc\Rbac\Exception; use Lmc\Rbac\Identity\IdentityInterface; use LmcRbacMvc\Identity\IdentityProviderInterface; -use LmcRbacMvc\Role\RoleProviderInterface; use LmcRbacMvc\Role\TraversalStrategyInterface; /** diff --git a/tests/Service/RoleServiceTest.php b/tests/Service/RoleServiceTest.php index 23af8be6..97c611cd 100644 --- a/tests/Service/RoleServiceTest.php +++ b/tests/Service/RoleServiceTest.php @@ -18,11 +18,13 @@ namespace LmcRbacMvcTest\Service; +use Lmc\Rbac\Role\Role; use LmcRbacMvc\Identity\IdentityInterface; use LmcRbacMvc\Identity\IdentityProviderInterface; use LmcRbacMvc\Role\InMemoryRoleProvider; use LmcRbacMvc\Role\RoleProviderInterface; use LmcRbacMvc\Service\RoleService; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use LmcRbacMvc\Role\RecursiveRoleIteratorStrategy; use LmcRbacMvc\Role\TraversalStrategyInterface; @@ -178,13 +180,25 @@ public static function roleProvider(): array 'member' ], 'doesMatch' => true + ], + // With Role objects + [ + 'rolesConfig' => [ + 'member', + 'guest' + ], + 'identityRoles' => [ + 'member' + ], + 'rolesToCheck' => [ + new Role('member'), + ], + 'doesMatch' => true ] ]; } - /** - * @dataProvider roleProvider - */ + #[DataProvider('roleProvider')] public function testMatchIdentityRoles(array $rolesConfig, array $identityRoles, array $rolesToCheck, $doesMatch) { $identity = $this->createMock('Lmc\Rbac\Identity\IdentityInterface');