Skip to content

Commit 92f729f

Browse files
author
Lucas Michot
committed
Add an extra test.
1 parent 2af6452 commit 92f729f

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/TokenTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Laravel\Passport\Passport;
66
use Laravel\Passport\Token;
77
use PHPUnit\Framework\TestCase;
8+
use ReflectionObject;
89

910
class TokenTest extends TestCase
1011
{
@@ -58,4 +59,20 @@ public function test_token_can_determine_if_it_has_inherited_scopes()
5859
$this->assertTrue($token->can('something'));
5960
$this->assertTrue($token->can('admin:webhooks:write'));
6061
}
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+
}
6178
}

0 commit comments

Comments
 (0)