1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace OpenOrchestra\FunctionalTests\ApiBundle\Controller; |
4
|
|
|
|
5
|
|
|
use OpenOrchestra\FunctionalTests\Utils\AbstractAuthenticatedTest; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Class ApiControllersSecurityTest |
9
|
|
|
* |
10
|
|
|
* @group apiFunctional |
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
|
|
|
$this->assertEquals(403, $this->client->getResponse()->getStatusCode()); |
27
|
|
|
|
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @return array |
32
|
|
|
*/ |
33
|
|
|
public function provideApiUrl() |
34
|
|
|
{ |
35
|
|
|
return array( |
36
|
|
|
1 => array('/api/node/show/root/2/fr'), |
37
|
|
|
3 => array('/api/node/delete/root', "DELETE"), |
38
|
|
|
4 => array('/api/node/root/children/update/order', 'PUT'), |
39
|
|
|
5 => array('/api/block/list/shared/fr'), |
40
|
|
|
6 => array('/api/block/list/block-component'), |
41
|
|
|
8 => array('/api/content-type'), |
42
|
|
|
12 => array('/api/site'), |
43
|
|
|
17 => array('/api/keyword'), |
44
|
|
|
20 => array('/api/group/list'), |
45
|
|
|
21 => array('/api/group/user/list'), |
46
|
|
|
22 => array('/api/group/duplicate', "POST"), |
47
|
|
|
24 => array('/api/content/duplicate', "POST"), |
48
|
|
|
25 => array('/api/content/delete/lorem_ipsum', "DELETE"), |
49
|
|
|
30 => array('/api/redirection'), |
50
|
|
|
32 => array('/api/redirection/node/2/root/fr'), |
51
|
|
|
33 => array('/api/status'), |
52
|
|
|
35 => array('/api/content/new-version/r5_3_portes/fr/2', 'POST'), |
53
|
|
|
36 => array('/api/node/new-version/root/fr/1', 'POST') |
54
|
|
|
); |
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
|