77use Exception ;
88use PHPUnit \Framework \TestCase ;
99use SimpleSAML \Configuration ;
10+ use SimpleSAML \Module \metarefresh \MetaLoader ;
1011
1112final class MetaLoaderTest extends TestCase
1213{
1314 /** \SimpleSAML\Module\metarefresh\MetaLoader */
14- private $ metaloader ;
15+ private MetaLoader $ metaloader ;
1516
1617 /** @var \SimpleSAML\Configuration */
17- private $ config ;
18+ private Configuration $ config ;
1819
1920 /** @var string */
2021 private $ tmpdir ;
2122
22- /** @var array */
23+ /** @var array<mixed> */
2324 private $ source = [
2425 'outputFormat ' => 'flatfile ' ,
2526 'conditionalGET ' => false ,
@@ -30,7 +31,7 @@ final class MetaLoaderTest extends TestCase
3031 ],
3132 ];
3233
33- /** @var array */
34+ /** @var array<mixed> */
3435 private $ expected = [
3536 'entityid ' => 'https://idp.example.com/idp/shibboleth ' ,
3637 'description ' => ['en ' => 'OrganizationName ' ,],
@@ -110,9 +111,12 @@ public function testMetaLoader(): void
110111 } catch (Exception $ e ) {
111112 $ this ->fail ('Metarefresh does not produce syntactially valid code ' );
112113 }
114+
115+ // @phpstan-ignore variable.undefined
113116 $ this ->assertArrayHasKey ('https://idp.example.com/idp/shibboleth ' , $ metadata );
114117
115118 $ this ->assertTrue (
119+ // @phpstan-ignore variable.undefined
116120 empty (array_diff_key ($ this ->expected , $ metadata ['https://idp.example.com/idp/shibboleth ' ])),
117121 );
118122 }
@@ -135,12 +139,12 @@ public function testWriteMetadataFiles(): void
135139 $ this ->metaloader ->writeMetadataFiles ($ this ->tmpdir );
136140 $ this ->assertFileExists ($ this ->tmpdir . '/saml20-idp-remote.php ' );
137141
138- /** @psalm-suppress UnresolvableInclude */
139142 @include_once ($ this ->tmpdir . '/saml20-idp-remote.php ' );
140- /** @psalm-suppress UndefinedVariable */
143+
144+ // @phpstan-ignore variable.undefined
141145 $ this ->assertArrayHasKey ('https://idp.example.com/idp/shibboleth ' , $ metadata );
142146 $ this ->assertTrue (
143- /** @psalm-suppress UndefinedVariable */
147+ // @phpstan-ignore variable.undefined
144148 empty (array_diff_key ($ this ->expected , $ metadata ['https://idp.example.com/idp/shibboleth ' ])),
145149 );
146150 }
@@ -162,8 +166,12 @@ public function testMetaLoaderSetExpiryWhenNotPresent(): void
162166 } catch (Exception $ e ) {
163167 $ this ->fail ('Metarefresh does not produce syntactially valid code ' );
164168 }
169+
170+ // @phpstan-ignore variable.undefined
165171 $ this ->assertArrayHasKey ('https://idp.example.com/idp/shibboleth ' , $ metadata );
172+ // @phpstan-ignore variable.undefined
166173 $ this ->assertArrayHasKey ('expire ' , $ metadata ['https://idp.example.com/idp/shibboleth ' ]);
174+ // @phpstan-ignore variable.undefined
167175 $ this ->assertEquals (1000 , $ metadata ['https://idp.example.com/idp/shibboleth ' ]['expire ' ]);
168176 }
169177
@@ -194,9 +202,11 @@ public function testAttributewhitelist1(): void
194202 $ this ->fail ('Metarefresh does not produce syntactially valid code ' );
195203 }
196204 /* Check we matched the IdP */
205+ // @phpstan-ignore variable.undefined
197206 $ this ->assertArrayHasKey ('https://idp.example.com/idp/shibboleth ' , $ metadata );
198207
199208 $ this ->assertTrue (
209+ // @phpstan-ignore variable.undefined
200210 empty (array_diff_key ($ this ->expected , $ metadata ['https://idp.example.com/idp/shibboleth ' ])),
201211 );
202212 }
@@ -263,9 +273,11 @@ public function testAttributewhitelist3(): void
263273 }
264274
265275 /* Check we matched the IdP */
276+ // @phpstan-ignore variable.undefined
266277 $ this ->assertArrayHasKey ('https://idp.example.com/idp/shibboleth ' , $ metadata );
267278
268279 $ this ->assertTrue (
280+ // @phpstan-ignore variable.undefined
269281 empty (array_diff_key ($ this ->expected , $ metadata ['https://idp.example.com/idp/shibboleth ' ])),
270282 );
271283 }
0 commit comments