Failed Conditions
Push — master ( b9670c...4ba57f )
by Zac
16:20 queued 37s
created

ApiControllerTest::testGetAllInsufficentPerms()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 7
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 7
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace Overwatch\ExpectationBundle\Tests\Controller;
4
5
use Overwatch\UserBundle\Tests\Base\FunctionalTestCase;
6
use Symfony\Component\HttpFoundation\Response;
7
8
/**
9
 * ApiControllerTest
10
 * Functional test of API method provided by the APIController
11
 */
12
class ApiControllerTest extends FunctionalTestCase
13
{
14
    public function testGetAll()
15
    {
16
        $expectations = [
17
            'toPing',
18
            'toResolveTo',
19
            'toRespondHttp',
20
            'toRespondWithMimeType',
21
            'toContainText',
22
        ];
23
24
        $this->logIn('ROLE_ADMIN');
25
        $this->client->request('GET', '/api/expectations');
26
27
        $this->assertJsonResponse($this->client->getResponse());
28
        $this->assertJsonStringEqualsJsonString(json_encode($expectations), $this->client->getResponse()->getContent());
29
    }
30
31 View Code Duplication
    public function testGetAllInsufficentPerms()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
32
    {
33
        $this->logIn('ROLE_USER');
34
        $this->client->request('GET', '/api/expectations');
35
36
        $this->assertEquals(Response::HTTP_FORBIDDEN, $this->client->getResponse()->getStatusCode());
37
    }
38
}
39