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

RPDiscoveryJwksUriKeys   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
dl 0
loc 15
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 7 1
A getTestId() 0 3 1
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