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

ClientRegistrationEndpointTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 6 2
A theClientIsNotAuthenticated() 0 13 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\ClientRegistration;
15
16
use OAuth2Framework\Component\Core\AccessToken\AccessToken;
17
use OAuth2Framework\Component\Core\AccessToken\AccessTokenRepository;
18
use OAuth2Framework\Component\Core\Client\ClientId;
19
use OAuth2Framework\Component\Core\DataBag\DataBag;
20
use OAuth2Framework\Component\Core\UserAccount\UserAccountId;
21
use OAuth2Framework\Component\TokenRevocationEndpoint\TokenRevocationEndpoint;
22
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
23
24
/**
25
 * @group Bundle
26
 * @group Functional
27
 * @group Grant
28
 * @group ClientRegistration
29
 */
30
class ClientRegistrationEndpointTest extends WebTestCase
31
{
32
    /**
33
     * {@inheritdoc}
34
     */
35
    protected function setUp()
36
    {
37
        if (!class_exists(TokenRevocationEndpoint::class)) {
38
            $this->markTestSkipped('The component "oauth2-framework/client-registration-endpoint" is not installed.');
39
        }
40
    }
41
42
    /**
43
     * @test
44
     */
45
    public function theClientIsNotAuthenticated()
46
    {
47
        $client = static::createClient();
48
        $client->request('POST', '/client/management', [], [], ['HTTPS' => 'on'], null);
49
        $response = $client->getResponse();
50
        self::assertEquals(201, $response->getStatusCode());
51
        dump($response->headers->all());
52
        $content = json_decode($response->getContent(), true);
53
54
        $container = $client->getContainer();
55
        dump($container->get('MyClientRepository')->find(ClientId::create($content['client_id'])));
56
        self::assertEquals('', $response->getContent());
57
    }
58
}
59