@@ -30,7 +30,7 @@ public function testIsGrantedLink(): void
3030 $ obj = new \stdClass ();
3131 $ barObj = new \stdClass ();
3232 $ operation = new GetCollection (uriVariables: [
33- 'barId ' => new Link (toProperty: 'bar ' , fromClass: ' Bar ' , security: 'is_granted("some_voter", "bar") ' ),
33+ 'barId ' => new Link (toProperty: 'bar ' , fromClass: $ barObj ::class , security: 'is_granted("some_voter", "bar") ' ),
3434 ], class: \stdClass::class);
3535 $ decorated = $ this ->createMock (ProviderInterface::class);
3636 $ decorated ->method ('provide ' )->willReturn ($ obj );
@@ -39,7 +39,7 @@ public function testIsGrantedLink(): void
3939 $ request ->attributes = $ parameterBag ;
4040 $ request ->attributes ->set ('bar ' , $ barObj );
4141 $ resourceAccessChecker = $ this ->createMock (ResourceAccessCheckerInterface::class);
42- $ resourceAccessChecker ->expects ($ this ->once ())->method ('isGranted ' )->with (' Bar ' , 'is_granted("some_voter", "bar") ' , ['object ' => $ obj , 'previous_object ' => null , 'request ' => $ request , 'bar ' => $ barObj , 'barId ' => 1 , 'operation ' => $ operation ])->willReturn (true );
42+ $ resourceAccessChecker ->expects ($ this ->once ())->method ('isGranted ' )->with ($ barObj ::class , 'is_granted("some_voter", "bar") ' , ['object ' => $ obj , 'previous_object ' => null , 'request ' => $ request , 'bar ' => $ barObj , 'barId ' => 1 , 'operation ' => $ operation ])->willReturn (true );
4343 $ accessChecker = new SecurityParameterProvider ($ decorated , $ resourceAccessChecker );
4444 $ accessChecker ->provide ($ operation , ['barId ' => 1 ], ['request ' => $ request ]);
4545 }
@@ -51,7 +51,7 @@ public function testIsNotGrantedLink(): void
5151 $ obj = new \stdClass ();
5252 $ barObj = new \stdClass ();
5353 $ operation = new GetCollection (uriVariables: [
54- 'barId ' => new Link (toProperty: 'bar ' , fromClass: ' Bar ' , security: 'is_granted("some_voter", "bar") ' ),
54+ 'barId ' => new Link (toProperty: 'bar ' , fromClass: $ barObj ::class , security: 'is_granted("some_voter", "bar") ' ),
5555 ], class: \stdClass::class);
5656 $ decorated = $ this ->createMock (ProviderInterface::class);
5757 $ decorated ->method ('provide ' )->willReturn ($ obj );
@@ -60,7 +60,7 @@ public function testIsNotGrantedLink(): void
6060 $ request ->attributes = $ parameterBag ;
6161 $ request ->attributes ->set ('bar ' , $ barObj );
6262 $ resourceAccessChecker = $ this ->createMock (ResourceAccessCheckerInterface::class);
63- $ resourceAccessChecker ->expects ($ this ->once ())->method ('isGranted ' )->with (' Bar ' , 'is_granted("some_voter", "bar") ' , ['object ' => $ obj , 'previous_object ' => null , 'request ' => $ request , 'bar ' => $ barObj , 'barId ' => 1 , 'operation ' => $ operation ])->willReturn (false );
63+ $ resourceAccessChecker ->expects ($ this ->once ())->method ('isGranted ' )->with ($ barObj ::class , 'is_granted("some_voter", "bar") ' , ['object ' => $ obj , 'previous_object ' => null , 'request ' => $ request , 'bar ' => $ barObj , 'barId ' => 1 , 'operation ' => $ operation ])->willReturn (false );
6464 $ accessChecker = new SecurityParameterProvider ($ decorated , $ resourceAccessChecker );
6565 $ accessChecker ->provide ($ operation , ['barId ' => 1 ], ['request ' => $ request ]);
6666 }
@@ -73,7 +73,7 @@ public function testSecurityMessageLink(): void
7373 $ obj = new \stdClass ();
7474 $ barObj = new \stdClass ();
7575 $ operation = new GetCollection (uriVariables: [
76- 'barId ' => new Link (toProperty: 'bar ' , fromClass: ' Bar ' , security: 'is_granted("some_voter", "bar") ' , securityMessage: 'You are not admin. ' ),
76+ 'barId ' => new Link (toProperty: 'bar ' , fromClass: $ barObj ::class , security: 'is_granted("some_voter", "bar") ' , securityMessage: 'You are not admin. ' ),
7777 ], class: \stdClass::class);
7878 $ decorated = $ this ->createMock (ProviderInterface::class);
7979 $ decorated ->method ('provide ' )->willReturn ($ obj );
@@ -82,7 +82,7 @@ public function testSecurityMessageLink(): void
8282 $ request ->attributes = $ parameterBag ;
8383 $ request ->attributes ->set ('bar ' , $ barObj );
8484 $ resourceAccessChecker = $ this ->createMock (ResourceAccessCheckerInterface::class);
85- $ resourceAccessChecker ->expects ($ this ->once ())->method ('isGranted ' )->with (' Bar ' , 'is_granted("some_voter", "bar") ' , ['object ' => $ obj , 'previous_object ' => null , 'request ' => $ request , 'bar ' => $ barObj , 'barId ' => 1 , 'operation ' => $ operation ])->willReturn (false );
85+ $ resourceAccessChecker ->expects ($ this ->once ())->method ('isGranted ' )->with ($ barObj ::class , 'is_granted("some_voter", "bar") ' , ['object ' => $ obj , 'previous_object ' => null , 'request ' => $ request , 'bar ' => $ barObj , 'barId ' => 1 , 'operation ' => $ operation ])->willReturn (false );
8686 $ accessChecker = new SecurityParameterProvider ($ decorated , $ resourceAccessChecker );
8787 $ accessChecker ->provide ($ operation , ['barId ' => 1 ], ['request ' => $ request ]);
8888 }
0 commit comments