RPResponseTypeCodeTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getTestId() 0 3 1
A execute() 0 15 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Facile\OpenIDClient\ConformanceTest\RpTest\ResponseTypeAndResponseMode;
6
7
use PHPUnit\Framework\Assert;
8
use Facile\OpenIDClient\ConformanceTest\RpTest\AbstractRpTest;
9
use Facile\OpenIDClient\ConformanceTest\TestInfo;
10
use Facile\OpenIDClient\Service\AuthorizationService;
11
12
class RPResponseTypeCodeTest extends AbstractRpTest
13
{
14
    public function getTestId(): string
15
    {
16
        return 'rp-response_type-code';
17
    }
18
19
    public function execute(TestInfo $testInfo): void
20
    {
21
        $client = $this->registerClient($testInfo);
22
23
        Assert::assertSame('code', $testInfo->getResponseType());
24
25
        // Get authorization redirect uri
26
        $authorizationService = new AuthorizationService();
0 ignored issues
show
Bug introduced by
The call to Facile\OpenIDClient\Serv...nService::__construct() has too few arguments starting with tokenSetFactory. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

26
        $authorizationService = /** @scrutinizer ignore-call */ new AuthorizationService();

This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
27
        $uri = $authorizationService->getAuthorizationUri($client, ['response_type' => $testInfo->getResponseType()]);
28
        // Simulate a redirect and create the server request
29
        $serverRequest = $this->simulateAuthRedirect($uri);
30
31
        $params = $authorizationService->getCallbackParams($serverRequest, $client);
32
33
        Assert::assertArrayHasKey('code', $params);
34
    }
35
}
36