Failed Conditions
Push — ng ( 7180d6...8c4fca )
by Florent
04:12
created

theMetadataEndpointIsAvailable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 8
nc 1
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 theMetadataEndpointIsAvailable()
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::assertInternalType('array', $content);
49
    }
50
}
51