File tree Expand file tree Collapse file tree 3 files changed +37
-8
lines changed
tests/Integration/Domain/Identity/Service Expand file tree Collapse file tree 3 files changed +37
-8
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,3 @@ services:
22 PhpList\Core\Domain\Subscription\Service\Provider\SubscriberProvider :
33 autowire : true
44 autoconfigure : true
5-
6- PhpList\Core\Domain\Messaging\Service\Provider\BounceActionProvider :
7- autowire : true
8- autoconfigure : true
Original file line number Diff line number Diff line change @@ -108,9 +108,7 @@ services:
108108 arguments :
109109 - !tagged_iterator { tag: 'phplist.bounce_action_handler' }
110110
111- # I18n
112- PhpList\Core\Domain\Common\I18n\SimpleTranslator :
111+ PhpList\Core\Domain\Identity\Service\PermissionChecker :
113112 autowire : true
114113 autoconfigure : true
115-
116- PhpList\Core\Domain\Common\I18n\TranslatorInterface : ' @PhpList\Core\Domain\Common\I18n\SimpleTranslator'
114+ public : true
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace PhpList \Core \Tests \Integration \Domain \Identity \Service ;
6+
7+ use PhpList \Core \Domain \Identity \Model \Administrator ;
8+ use PhpList \Core \Domain \Identity \Service \PermissionChecker ;
9+ use PhpList \Core \Domain \Subscription \Model \SubscriberList ;
10+ use Symfony \Bundle \FrameworkBundle \Test \KernelTestCase ;
11+
12+ final class PermissionCheckerTest extends KernelTestCase
13+ {
14+ private PermissionChecker $ checker ;
15+
16+ protected function setUp (): void
17+ {
18+ parent ::setUp ();
19+ $ this ->checker = self ::getContainer ()->get (PermissionChecker::class);
20+ }
21+
22+ public function testServiceIsRegisteredInContainer (): void
23+ {
24+ self ::assertInstanceOf (PermissionChecker::class, $ this ->checker );
25+ self ::assertSame ($ this ->checker , self ::getContainer ()->get (PermissionChecker::class));
26+ }
27+
28+ public function testSuperUserCanManageAnyResource (): void
29+ {
30+ $ admin = new Administrator ();
31+ $ admin ->setSuperUser (true );
32+ $ resource = $ this ->createMock (SubscriberList::class);
33+ $ this ->assertTrue ($ this ->checker ->canManage ($ admin , $ resource ));
34+ }
35+ }
You can’t perform that action at this time.
0 commit comments