AuthorizationControllersTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 31
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testTokenCreation() 0 12 1
1
<?php
2
3
namespace OpenOrchestra\FunctionalTests\UserAdminBundle\Controller;
4
5
use OpenOrchestra\BaseBundle\Tests\AbstractTest\AbstractWebTestCase;
6
use Symfony\Bundle\FrameworkBundle\Client;
7
8
/**
9
 * Class AuthorizationControllersTest
10
 *
11
 * @group securityCheck
12
 */
13
class AuthorizationControllersTest extends AbstractWebTestCase
14
{
15
    /**
16
     * @var Client
17
     */
18
    protected $client;
19
20
    /**
21
     * Set up the test
22
     */
23
    public function setUp()
24
    {
25
        $this->client = static::createClient();
26
    }
27
28
    /**
29
     * Test token creation and usage
30
     */
31
    public function testTokenCreation()
32
    {
33
        $headers = array(
34
            'PHP_AUTH_USER' => 'test_key',
35
            'PHP_AUTH_PW' => 'test_secret',
36
            'HTTP_username' => 'p-admin',
37
            'HTTP_password' => 'p-admin',
38
        );
39
        $this->client->request('GET', '/oauth/access_token?grant_type=password', array(), array(), $headers);
40
        $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
41
        $this->assertSame('application/json', $this->client->getResponse()->headers->get('content-type'));
42
    }
43
}
44