File tree 1 file changed +17
-0
lines changed 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 5
5
use Laravel \Passport \Passport ;
6
6
use Laravel \Passport \Token ;
7
7
use PHPUnit \Framework \TestCase ;
8
+ use ReflectionObject ;
8
9
9
10
class TokenTest extends TestCase
10
11
{
@@ -58,4 +59,20 @@ public function test_token_can_determine_if_it_has_inherited_scopes()
58
59
$ this ->assertTrue ($ token ->can ('something ' ));
59
60
$ this ->assertTrue ($ token ->can ('admin:webhooks:write ' ));
60
61
}
62
+
63
+ public function test_token_resolves_inherited_scopes ()
64
+ {
65
+ $ token = new Token ;
66
+
67
+ $ reflector = new ReflectionObject ($ token );
68
+ $ method = $ reflector ->getMethod ('resolveInheritedScopes ' );
69
+ $ method ->setAccessible (true );
70
+ $ inheritedScopes = $ method ->invoke ($ token , 'admin:webhooks:read ' );
71
+
72
+ $ this ->assertSame ([
73
+ 'admin ' ,
74
+ 'admin:webhooks ' ,
75
+ 'admin:webhooks:read ' ,
76
+ ], $ inheritedScopes );
77
+ }
61
78
}
You can’t perform that action at this time.
0 commit comments