Completed
Push — master ( 798ee0...2329f6 )
by Lucas
08:18
created

WhoAmIControllerTest::testVersionsSchemaAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 9

Duplication

Lines 13
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 13
loc 13
rs 9.4285
cc 1
eloc 9
nc 1
nop 0
1
<?php
2
/**
3
 * functional test for /core/version
4
 */
5
6
namespace Graviton\SecurityBundle\Tests\Controller;
7
8
use Graviton\TestBundle\Test\RestTestCase;
9
10
/**
11
 * Basic functional test for /person/whoami.
12
 *
13
 * @author   List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
14
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
15
 * @link     http://swisscom.ch
16
 */
17
class WhoAmIControllerTest extends RestTestCase
18
{
19
20
    /**
21
     * Tests if get request returns data in right format
22
     *
23
     * @return void
24
     */
25 View Code Duplication
    public function testWhoAmIAction()
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...
26
    {
27
        $client = static::createRestClient();
28
        $client->request('GET', '/person/whoami/');
29
        $response = $client->getResponse();
30
31
        $this->assertContains('"username":', $response->getContent());
32
        $this->assertInternalType('string', $response->getContent());
33
    }
34
35
    /**
36
     * Tests if schema returns the right values
37
     *
38
     * @return void
39
     */
40 View Code Duplication
    public function testVersionsSchemaAction()
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...
41
    {
42
        $client = static::createRestClient();
43
        $client->request('GET', '/schema/person/whoami');
44
        $response = $client->getResponse();
45
46
        $this->assertEquals(
47
            '{"username":{"title":"The username of the logged in consultant","description":"your username",'.
48
            '"type":"string"},"additionalProperties":true}',
49
            $response->getContent()
50
        );
51
        $this->assertInternalType('string', $response->getContent());
52
    }
53
}
54