Failed Conditions
Push — ng ( f68947...95ea19 )
by Florent
04:36
created

MetadataEndpointTest::setUp()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * The MIT License (MIT)
7
 *
8
 * Copyright (c) 2014-2018 Spomky-Labs
9
 *
10
 * This software may be modified and distributed under the terms
11
 * of the MIT license.  See the LICENSE file for details.
12
 */
13
14
namespace OAuth2Framework\Bundle\Tests\Functional\Metadata;
15
16
use OAuth2Framework\Component\MetadataEndpoint\MetadataEndpoint;
17
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
18
19
/**
20
 * @group Bundle
21
 * @group Functional
22
 * @group Grant
23
 * @group Compiler
24
 */
25
class MetadataEndpointTest extends WebTestCase
26
{
27
    /**
28
     * {@inheritdoc}
29
     */
30
    protected function setUp()
31
    {
32
        if (!class_exists(MetadataEndpoint::class)) {
33
            $this->markTestSkipped('The component "oauth2-framework/metadata-endpoint" is not installed.');
34
        }
35
    }
36
37
    /**
38
     * @test
39
     */
40
    public function theClientIsNotAuthenticated()
41
    {
42
        $client = static::createClient();
43
        $client->request('GET', '/.well-known/openid-configuration', [], [], ['HTTPS' => 'on']);
44
        $response = $client->getResponse();
45
        self::assertEquals(200, $response->getStatusCode());
46
        self::assertEquals('application/json; charset=UTF-8', $response->headers->get('content-type'));
47
        $content = json_decode($response->getContent(), true);
48
        self::assertArrayHasKey('token_endpoint_auth_methods_supported', $content);
49
        self::assertArrayHasKey('token_endpoint', $content);
50
        self::assertArrayHasKey('token_introspection_endpoint', $content);
51
        self::assertArrayHasKey('token_revocation_endpoint', $content);
52
        self::assertArrayHasKey('issuer', $content);
53
        self::assertArrayHasKey('service_documentation', $content);
54
        self::assertArrayHasKey('op_policy_uri', $content);
55
        self::assertArrayHasKey('op_tos_uri', $content);
56
    }
57
}
58