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

WhoAmIControllerTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 59.46 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 2
dl 22
loc 37
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testWhoAmIAction() 9 9 1
A testVersionsSchemaAction() 13 13 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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