File tree 2 files changed +12
-11
lines changed
src/ExpressionLanguage/ExpressionFunction/Security
tests/ExpressionLanguage/ExpressionFunction/Security
2 files changed +12
-11
lines changed Original file line number Diff line number Diff line change 5
5
namespace Overblog \GraphQLBundle \ExpressionLanguage \ExpressionFunction \Security ;
6
6
7
7
use Overblog \GraphQLBundle \ExpressionLanguage \ExpressionFunction ;
8
- use Overblog \GraphQLBundle \Security \Security ;
9
8
10
9
final class IsRememberMe extends ExpressionFunction
11
10
{
12
- public function __construct (Security $ security )
11
+ public function __construct ()
13
12
{
14
13
parent ::__construct (
15
14
'isRememberMe ' ,
16
15
static function (): string {
17
16
return '$globalVariable->get( \'security \')->isRememberMe() ' ;
18
17
},
19
- static function () use ( $ security ): bool {
20
- return $ security ->isRememberMe ();
18
+ static function ($ arguments ): bool {
19
+ return $ arguments [ ' globalVariable ' ]-> get ( ' security ' ) ->isRememberMe ();
21
20
}
22
21
);
23
22
}
Original file line number Diff line number Diff line change 4
4
5
5
namespace Overblog \GraphQLBundle \Tests \ExpressionLanguage \ExpressionFunction \Security ;
6
6
7
+ use Overblog \GraphQLBundle \Definition \GlobalVariables ;
7
8
use Overblog \GraphQLBundle \ExpressionLanguage \ExpressionFunction \Security \IsRememberMe ;
8
9
use Overblog \GraphQLBundle \Tests \ExpressionLanguage \TestCase ;
9
10
10
11
class IsRememberMeTest extends TestCase
11
12
{
12
13
protected function getFunctions ()
13
14
{
14
- $ Security = $ this ->getSecurityIsGrantedWithExpectation (
15
- 'IS_AUTHENTICATED_REMEMBERED ' ,
16
- $ this ->any ()
17
- );
18
-
19
- return [new IsRememberMe ($ Security )];
15
+ return [new IsRememberMe ()];
20
16
}
21
17
22
18
public function testEvaluator (): void
23
19
{
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 ]);
25
27
$ this ->assertTrue ($ isRememberMe );
26
28
}
27
29
You can’t perform that action at this time.
0 commit comments