RPDiscoveryWebFingerUrl   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 9 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
 * Use WebFinger (RFC7033) and OpenID Provider Issuer Discovery to determine the location of the OpenID Provider.
14
 * The discovery should be done using URL syntax as user input identifier.
15
 *
16
 * An issuer location should be returned.
17
 */
18
class RPDiscoveryWebFingerUrl extends AbstractRpTest
19
{
20
21
    public function getTestId(): string
22
    {
23
        return 'rp-discovery-webfinger-url';
24
    }
25
26
    public function execute(TestInfo $testInfo): void
27
    {
28
        $input = $testInfo->getRoot() . '/' . $testInfo->getRpId() . '/' . $this->getTestId() . '/joe';
29
30
        $issuer = (new IssuerBuilder())
31
            ->build($input);
32
33
        $expected = sprintf('%s/%s/%s', $testInfo->getRoot(), $testInfo->getRpId(), $this->getTestId());
34
        Assert::assertSame($expected, $issuer->getMetadata()->getIssuer());
35
    }
36
}
37