Passed
Pull Request — master (#11)
by Pol
07:45
created

RPDiscoveryJwksUriKeys::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 7
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Facile\OpenIDClient\ConformanceTest\RpTest\Discovery;
6
7
use PHPUnit\Framework\Assert;
8
use Facile\OpenIDClient\ConformanceTest\RpTest\AbstractRpTest;
9
use Facile\OpenIDClient\ConformanceTest\TestInfo;
10
use Facile\OpenIDClient\Issuer\IssuerBuilder;
11
12
/**
13
 * The Relying Party uses keys from the jwks_uri which has been obtained from the OpenID Provider Metadata.
14
 *
15
 * Should be able to verify signed responses and/or encrypt requests using obtained keys.
16
 */
17
class RPDiscoveryJwksUriKeys extends AbstractRpTest
18
{
19
20
    public function getTestId(): string
21
    {
22
        return 'rp-discovery-jwks_uri-keys';
23
    }
24
25
    public function execute(TestInfo $testInfo): void
26
    {
27
        $configUri = sprintf('%s/%s/%s/.well-known/openid-configuration', $testInfo->getRoot(), $testInfo->getRpId(), $this->getTestId());
28
        $issuer = (new IssuerBuilder())
29
            ->build($configUri);
30
31
        Assert::assertCount(4, $issuer->getJwksProvider()->getJwks()['keys'] ?? []);
32
    }
33
}
34