Completed
Pull Request — develop (#9)
by
unknown
03:41
created

SmartIdTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 43
Duplicated Lines 25.58 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetFields() 11 11 1
A testGetAction() 0 5 1
A testGetMethod() 0 5 1
A testCreateResult() 0 5 1
A testHasValidationConstraints() 0 10 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
namespace Isign\Tests\Login;
3
4
use Isign\Login\SmartId;
5
use Isign\QueryInterface;
6
use Isign\Tests\TestCase;
7
8
class SmartIdTest extends TestCase
9
{
10 View Code Duplication
    public function testGetFields()
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...
11
    {
12
        $method = new SmartId('xxxxxxxxxxx', 'LT');
13
        
14
        $result = $method->getFields();
15
16
        $this->assertArrayHasKey('code', $result);
17
        $this->assertArrayHasKey('country', $result);
18
        $this->assertSame('xxxxxxxxxxx', $result['code']);
19
        $this->assertSame('LT', $result['country']);
20
    }
21
22
    public function testGetAction()
23
    {
24
        $method = new SmartId('', '');
25
        $this->assertSame('smartid/login', $method->getAction());
26
    }
27
28
    public function testGetMethod()
29
    {
30
        $method = new SmartId('', '');
31
        $this->assertSame(QueryInterface::POST, $method->getMethod());
32
    }
33
34
    public function testCreateResult()
35
    {
36
        $method = new SmartId('', '');
37
        $this->assertInstanceOf('Isign\Login\SmartIdResult', $method->createResult());
38
    }
39
40
    public function testHasValidationConstraints()
41
    {
42
        $method = new SmartId('', '');
43
        $collection = $method->getValidationConstraints();
44
45
        $this->assertInstanceOf(
46
            'Symfony\Component\Validator\Constraints\Collection',
47
            $collection
48
        );
49
    }
50
}
51