1010
1111use Ibexa \Bundle \AdminUi \ValueResolver \PolicyValueResolver ;
1212use Ibexa \Contracts \Core \Repository \RoleService ;
13+ use Ibexa \Contracts \Core \Repository \Values \User \Policy ;
1314use Ibexa \Contracts \Core \Repository \Values \User \PolicyDraft ;
15+ use Ibexa \Contracts \Core \Repository \Values \User \Role ;
1416use Ibexa \Contracts \Core \Repository \Values \User \RoleDraft ;
1517use PHPUnit \Framework \MockObject \MockObject ;
1618use PHPUnit \Framework \TestCase ;
@@ -32,16 +34,16 @@ protected function setUp(): void
3234
3335 public function testResolve (): void
3436 {
35- $ policyDraft = $ this ->createMock (PolicyDraft ::class);
36- $ policyDraft
37+ $ policy = $ this ->createMock (Policy ::class);
38+ $ policy
3739 ->method ('__get ' )
38- ->with ('originalId ' )
40+ ->with ('id ' )
3941 ->willReturn (123 );
4042
41- $ roleDraft = $ this ->createMock (RoleDraft ::class);
42- $ roleDraft
43+ $ role = $ this ->createMock (Role ::class);
44+ $ role
4345 ->method ('getPolicies ' )
44- ->willReturn ([$ policyDraft ]);
46+ ->willReturn ([$ policy ]);
4547
4648 $ attributes = [
4749 'roleId ' => '456 ' ,
@@ -51,18 +53,18 @@ public function testResolve(): void
5153 $ this ->roleService ->expects (self ::once ())
5254 ->method ('loadRole ' )
5355 ->with (456 )
54- ->willReturn ($ roleDraft );
56+ ->willReturn ($ role );
5557
5658 $ argumentMetadata = $ this ->createMock (ArgumentMetadata::class);
57- $ argumentMetadata ->method ('getType ' )->willReturn (PolicyDraft ::class);
59+ $ argumentMetadata ->method ('getType ' )->willReturn (Policy ::class);
5860 $ argumentMetadata ->method ('getName ' )->willReturn ('policy ' );
5961
6062 $ request = new Request ([], [], $ attributes );
6163
6264 $ result = iterator_to_array ($ this ->resolver ->resolve ($ request , $ argumentMetadata ));
6365
6466 self ::assertCount (1 , $ result );
65- self ::assertSame ($ policyDraft , $ result [0 ]);
67+ self ::assertSame ($ policy , $ result [0 ]);
6668 }
6769
6870 public function testResolvePolicyNotFound (): void
0 commit comments