Passed
Pull Request — master (#31)
by Tim
09:39
created

RegProcessTest.php$0 ➔ info()   A

Complexity

Conditions 1

Size

Total Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 2
rs 10
cc 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\Test\Module\webauthn\Controller;
6
7
use PHPUnit\Framework\TestCase;
8
use SimpleSAML\Auth\State;
9
use SimpleSAML\Configuration;
10
use SimpleSAML\Error;
11
use SimpleSAML\HTTP\RunnableResponse;
12
use SimpleSAML\Logger;
13
use SimpleSAML\Module\webauthn\Controller;
14
use SimpleSAML\Session;
15
use SimpleSAML\Utils;
16
use SimpleSAML\XHTML\Template;
17
use Symfony\Component\HttpFoundation\Request;
18
19
/**
20
 * Set of tests for the controllers in the "webauthn" module.
21
 *
22
 * @package SimpleSAML\Test
23
 */
24
class RegProcessTest extends TestCase
25
{
26
    /** @var \SimpleSAML\Configuration */
27
    protected $config;
28
29
    /** @var \SimpleSAML\Session */
30
    protected $session;
31
32
33
    /**
34
     * Set up for each test.
35
     * @return void
36
     */
37
    protected function setUp(): void
38
    {
39
        parent::setUp();
40
41
        $this->config = Configuration::loadFromArray(
42
            [
43
                'module.enable' => ['webauthn' => true],
44
                'secretsalt' => 'abc123',
45
                'enable.saml20-idp' => true,
46
            ],
47
            '[ARRAY]',
48
            'simplesaml'
49
        );
50
51
        $this->session = Session::getSessionFromRequest();
52
53
        $this->logger = new class () extends Logger {
54
            public static function info(string $str): void
55
            {
56
                // do nothing
57
            }
58
        };
59
    }
60
61
62
    /**
63
     * @return void
64
     */
65
    public function testRegProcess(): void
66
    {
67
        $this->markTestSkipped('Breaks testsuite');
68
69
        $_SERVER['REQUEST_URI'] = '/module.php/webauthn/regprocess';
70
        $request = Request::create(
71
            '/regprocess',
72
            'GET',
73
            ['StateId' => 'someStateId']
74
        );
75
76
77
        $c = new Controller\RegProcess($this->config, $this->session);
78
        $c->setAuthState(new class () extends State {
79
            public static function loadState(string $id, string $stage, bool $allowMissing = false): ?array
80
            {
81
                return [
82
//                    'FIDO2Displayname' => 'Donald Duck',
83
//                    'FIDO2Username' => 'dduck',
84
//                    'FIDO2Scope' => 'Ducktown',
85
//                    'FIDO2Tokens' => [],
86
//                    'FIDO2SignupChallenge' => 'abc123',
87
//                    'FIDO2AuthSuccessful' => true,
88
//                    'requestTokenModel' => 'something',
89
//                    'Source' => [
90
//                        'entityid' => 'https://idp.example.com',
91
//                    ],
92
                ];
93
            }
94
        });
95
96
        $response = $c->main($request);
97
98
        $this->assertTrue($response->isSuccessful());
99
    }
100
}
101