瀏覽代碼

Merge branch 'fix_remove_unecessary_modules_conditions' into release/2.4.beta

Olivier Massot 2 年之前
父節點
當前提交
06da13144f

+ 0 - 56
config/opentalent/modulesbyconditions.yaml

@@ -89,59 +89,3 @@ opentalent:
                 service:
                     name: App\Service\Network\Utils
                     function: isCMF
-        Pes:
-            conditions:
-                service:
-                    name: App\Service\Organization\Utils
-                    function: hasModule
-                    args:
-                        - 'Pes'
-        BergerLevrault:
-            conditions:
-                service:
-                    name: App\Service\Organization\Utils
-                    function: hasModule
-                    args:
-                        - 'BergerLevrault'
-        Jvs:
-            conditions:
-                service:
-                    name: App\Service\Organization\Utils
-                    function: hasModule
-                    args:
-                        - 'Jvs'
-        SddBank:
-            conditions:
-                service:
-                    name: App\Service\Organization\Utils
-                    function: hasModule
-                    args:
-                        - 'SddBank'
-        SddRegie:
-            conditions:
-                service:
-                    name: App\Service\Organization\Utils
-                    function: hasModule
-                    args:
-                        - 'SddRegie'
-        UnpaidPes:
-            conditions:
-                service:
-                    name: App\Service\Organization\Utils
-                    function: hasModule
-                    args:
-                        - 'UnpaidPes'
-        UnpaidBergerLevrault:
-            conditions:
-                service:
-                    name: App\Service\Organization\Utils
-                    function: hasModule
-                    args:
-                        - 'UnpaidBergerLevrault'
-        UnpaidJvs:
-            conditions:
-                service:
-                    name: App\Service\Organization\Utils
-                    function: hasModule
-                    args:
-                        - 'UnpaidJvs'

+ 1 - 1
src/Security/Voter/EntityVoter/AbstractEntityVoter.php

@@ -54,7 +54,7 @@ abstract class AbstractEntityVoter extends Voter
         protected Security $security,
         protected Utils $accessUtils,
         private InternalRequestsService $internalRequestsService,
-        EntityManagerInterface $em,
+        private EntityManagerInterface $em,
         private SwitchUser $switchUser
     ) {}
 

+ 4 - 4
tests/Unit/Security/Voter/EntityVoter/AbstractEntityVoterTest.php

@@ -65,7 +65,7 @@ class AbstractVoterTest extends TestCase
 {
     protected Security | MockObject $security;
     protected Utils | MockObject $accessUtils;
-    protected EntityManagerInterface | MockObject $entityManager;
+    protected EntityManagerInterface | MockObject $em;
     protected InternalRequestsService | MockObject $internalRequestsService;
     protected SwitchUser | MockObject $switchUserService;
 
@@ -114,7 +114,7 @@ class AbstractVoterTest extends TestCase
         $this->security = $this->getMockBuilder(Security::class)->disableOriginalConstructor()->getMock();
         $this->accessUtils = $this->getMockBuilder(Utils::class)->disableOriginalConstructor()->getMock();
         $this->internalRequestsService = $this->getMockBuilder(InternalRequestsService::class)->disableOriginalConstructor()->getMock();
-        $this->entityManager = $this->getMockBuilder(EntityManagerInterface::class)->disableOriginalConstructor()->getMock();
+        $this->em = $this->getMockBuilder(EntityManagerInterface::class)->disableOriginalConstructor()->getMock();
         $this->switchUserService = $this->getMockBuilder(SwitchUser::class)->disableOriginalConstructor()->getMock();
     }
 
@@ -129,7 +129,7 @@ class AbstractVoterTest extends TestCase
                 $this->security,
                 $this->accessUtils,
                 $this->internalRequestsService,
-                $this->entityManager,
+                $this->em,
                 $this->switchUserService
             ])
             ->setMethodsExcept([$methodName])
@@ -314,7 +314,7 @@ class AbstractVoterTest extends TestCase
         $_SERVER['HTTP_X_SWITCH_USER'] = 1;
 
         $this->security->expects(self::once())->method('getUser')->willReturn($originalUser);
-        $this->entityManager->expects(self::once())->method('find')->with(Access::class, 1)->willReturn($switchUser);
+        $this->em->expects(self::once())->method('find')->with(Access::class, 1)->willReturn($switchUser);
 
         $abstractVoter = $this->makeAbstractVoterMockFor('getUser');