File tree Expand file tree Collapse file tree 2 files changed +12
-11
lines changed
src/ExpressionLanguage/ExpressionFunction/Security
tests/ExpressionLanguage/ExpressionFunction/Security Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Original file line number Diff line number Diff line change 55namespace Overblog \GraphQLBundle \ExpressionLanguage \ExpressionFunction \Security ;
66
77use Overblog \GraphQLBundle \ExpressionLanguage \ExpressionFunction ;
8- use Overblog \GraphQLBundle \Security \Security ;
98
109final class IsRememberMe extends ExpressionFunction
1110{
12- public function __construct (Security $ security )
11+ public function __construct ()
1312 {
1413 parent ::__construct (
1514 'isRememberMe ' ,
1615 static function (): string {
1716 return '$globalVariable->get( \'security \')->isRememberMe() ' ;
1817 },
19- static function () use ( $ security ): bool {
20- return $ security ->isRememberMe ();
18+ static function ($ arguments ): bool {
19+ return $ arguments [ ' globalVariable ' ]-> get ( ' security ' ) ->isRememberMe ();
2120 }
2221 );
2322 }
Original file line number Diff line number Diff line change 44
55namespace Overblog \GraphQLBundle \Tests \ExpressionLanguage \ExpressionFunction \Security ;
66
7+ use Overblog \GraphQLBundle \Definition \GlobalVariables ;
78use Overblog \GraphQLBundle \ExpressionLanguage \ExpressionFunction \Security \IsRememberMe ;
89use Overblog \GraphQLBundle \Tests \ExpressionLanguage \TestCase ;
910
1011class IsRememberMeTest extends TestCase
1112{
1213 protected function getFunctions ()
1314 {
14- $ Security = $ this ->getSecurityIsGrantedWithExpectation (
15- 'IS_AUTHENTICATED_REMEMBERED ' ,
16- $ this ->any ()
17- );
18-
19- return [new IsRememberMe ($ Security )];
15+ return [new IsRememberMe ()];
2016 }
2117
2218 public function testEvaluator (): void
2319 {
24- $ isRememberMe = $ this ->expressionLanguage ->evaluate ('isRememberMe() ' );
20+ $ security = $ this ->getSecurityIsGrantedWithExpectation (
21+ 'IS_AUTHENTICATED_REMEMBERED ' ,
22+ $ this ->any ()
23+ );
24+ $ globalVariable = new GlobalVariables (['security ' => $ security ]);
25+
26+ $ isRememberMe = $ this ->expressionLanguage ->evaluate ('isRememberMe() ' , ['globalVariable ' => $ globalVariable ]);
2527 $ this ->assertTrue ($ isRememberMe );
2628 }
2729
You can’t perform that action at this time.
0 commit comments