18
18
use PHPUnit \Framework \TestCase ;
19
19
use SimpleSAML \Configuration ;
20
20
use SimpleSAML \Module \oidc \Entities \ScopeEntity ;
21
+ use SimpleSAML \Module \oidc \Factories \Entities \ScopeEntityFactory ;
21
22
use SimpleSAML \Module \oidc \ModuleConfig ;
22
23
use SimpleSAML \Module \oidc \Repositories \ScopeRepository ;
23
24
use SimpleSAML \Module \oidc \Services \DatabaseMigration ;
@@ -48,11 +49,11 @@ public static function setUpBeforeClass(): void
48
49
*/
49
50
public function testGetScopeEntityByIdentifier (): void
50
51
{
51
- $ scopeRepository = new ScopeRepository (new ModuleConfig ());
52
+ $ scopeRepository = new ScopeRepository (new ModuleConfig (), new ScopeEntityFactory () );
52
53
53
54
$ scope = $ scopeRepository ->getScopeEntityByIdentifier ('openid ' );
54
55
55
- $ expected = ScopeEntity:: fromData (
56
+ $ expected = new ScopeEntity (
56
57
'openid ' ,
57
58
'openid ' ,
58
59
);
@@ -65,7 +66,7 @@ public function testGetScopeEntityByIdentifier(): void
65
66
*/
66
67
public function testGetUnknownScope (): void
67
68
{
68
- $ scopeRepository = new ScopeRepository (new ModuleConfig ());
69
+ $ scopeRepository = new ScopeRepository (new ModuleConfig (), new ScopeEntityFactory () );
69
70
70
71
$ this ->assertNull ($ scopeRepository ->getScopeEntityByIdentifier ('none ' ));
71
72
}
@@ -75,17 +76,17 @@ public function testGetUnknownScope(): void
75
76
*/
76
77
public function testFinalizeScopes (): void
77
78
{
78
- $ scopeRepository = new ScopeRepository (new ModuleConfig ());
79
+ $ scopeRepository = new ScopeRepository (new ModuleConfig (), new ScopeEntityFactory () );
79
80
$ scopes = [
80
- ScopeEntity:: fromData ('openid ' ),
81
- ScopeEntity:: fromData ('basic ' ),
81
+ new ScopeEntity ('openid ' ),
82
+ new ScopeEntity ('basic ' ),
82
83
];
83
84
$ client = ClientRepositoryTest::getClient ('clientid ' );
84
85
85
86
$ finalizedScopes = $ scopeRepository ->finalizeScopes ($ scopes , 'any ' , $ client );
86
87
87
88
$ expectedScopes = [
88
- ScopeEntity:: fromData ('openid ' ),
89
+ new ScopeEntity ('openid ' ),
89
90
];
90
91
$ this ->assertEquals ($ expectedScopes , $ finalizedScopes );
91
92
}
0 commit comments