22
33declare (strict_types=1 );
44
5- namespace SimpleSAML \Test \Module \oidc \unit \Utils ;
5+ namespace SimpleSAML \Test \Module \oidc \unit \Helpers ;
66
77use League \OAuth2 \Server \Entities \ScopeEntityInterface ;
8+ use PHPUnit \Framework \Attributes \CoversClass ;
89use PHPUnit \Framework \MockObject \Stub ;
910use PHPUnit \Framework \TestCase ;
11+ use SimpleSAML \Module \oidc \Helpers \Scope ;
1012use SimpleSAML \Module \oidc \Server \Exceptions \OidcServerException ;
11- use SimpleSAML \Module \oidc \Utils \ScopeHelper ;
1213
13- /**
14- * @covers \SimpleSAML\Module\oidc\Utils\ScopeHelper
15- */
16- class ScopeHelperTest extends TestCase
14+ #[CoversClass(Scope::class)]
15+ class ScopeTest extends TestCase
1716{
1817 protected Stub $ scopeEntityOpenIdStub ;
1918 protected Stub $ scopeEntityProfileStub ;
@@ -34,20 +33,25 @@ protected function setUp(): void
3433 ];
3534 }
3635
36+ protected function sut (): Scope
37+ {
38+ return new Scope ();
39+ }
40+
3741 /**
3842 * @throws \SimpleSAML\Module\oidc\Server\Exceptions\OidcServerException
3943 */
4044 public function testCanCheckScopeExistence (): void
4145 {
42- $ this ->assertTrue (ScopeHelper:: scopeExists ($ this ->scopeEntitiesArray , 'openid ' ));
43- $ this ->assertTrue (ScopeHelper:: scopeExists ($ this ->scopeEntitiesArray , 'profile ' ));
44- $ this ->assertFalse (ScopeHelper:: scopeExists ($ this ->scopeEntitiesArray , 'invalid ' ));
46+ $ this ->assertTrue ($ this -> sut ()-> exists ($ this ->scopeEntitiesArray , 'openid ' ));
47+ $ this ->assertTrue ($ this -> sut ()-> exists ($ this ->scopeEntitiesArray , 'profile ' ));
48+ $ this ->assertFalse ($ this -> sut ()-> exists ($ this ->scopeEntitiesArray , 'invalid ' ));
4549 }
4650
4751 public function testThrowsForInvalidScopeEntity (): void
4852 {
4953 $ this ->expectException (OidcServerException::class);
5054
51- ScopeHelper:: scopeExists (['invalid ' ], 'test ' );
55+ $ this -> sut ()-> exists (['invalid ' ], 'test ' );
5256 }
5357}
0 commit comments