ApiControllersSecurityTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testApi() 0 6 1
A provideApiUrl() 0 7 1
1
<?php
2
3
namespace OpenOrchestra\FunctionalTests\UserAdminBundle\Controller;
4
5
use OpenOrchestra\FunctionalTests\Utils\AbstractAuthenticatedTest;
6
7
/**
8
 * Class ApiControllersSecurityTest
9
 *
10
 * @group securityCheck
11
 */
12
class ApiControllersSecurityTest extends AbstractAuthenticatedTest
13
{
14
    protected $username = "userNoAccess";
15
    protected $password = "userNoAccess";
16
17
    /**
18
     * @param string $url
19
     * @param string $method
20
     *
21
     * @dataProvider provideApiUrl
22
     */
23
    public function testApi($url, $method = 'GET')
24
    {
25
        $this->client->request($method, $url . '?access_token=' . $this->getAccessToken());
26
27
        $this->assertEquals(403, $this->client->getResponse()->getStatusCode());
28
    }
29
30
    /**
31
     * @return array
32
     */
33
    public function provideApiUrl()
34
    {
35
        return array(
36
            array('/api/user/fake_email'),
37
            array('/api/user'),
38
        );
39
    }
40
}
41