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

MetadataEndpointTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 26
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 6 2
A theMetadataEndpointIsAvailable() 0 10 1
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