Test Failed
Pull Request — develop (#12)
by
unknown
02:48
created

MobileHashTest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 2
dl 0
loc 55
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 12 1
A testGetFields() 0 12 1
A testGetAction() 0 4 1
A testGetMethod() 0 4 1
A testCreateResult() 0 4 1
A testHasValidationConstraints() 0 9 1
1
<?php
2
namespace Isign\Tests\Sign;
3
4
use Isign\QueryInterface;
5
use Isign\Sign\MobileHash;
6
use Isign\Tests\TestCase;
7
8
class MobileHashTest extends TestCase
9
{
10
    private $method;
11
12
    public function setUp()
13
    {
14
        $this->method = new MobileHash(
15
            '+370xxxxxxxx',
16
            'xxxxxxxxxxx',
17
            'd04b98f48e8f8bcc15c6ae5ac050801cd6dcfd428fb5f9e65c4e16e7807340fa',
18
            'SHA256',
19
            'RSA',
20
            'Test message',
21
            'EN'
22
        );
23
    }
24
    
25
    public function testGetFields()
26
    {
27
        $result = $this->method->getFields();
28
29
        $this->assertSame('+370xxxxxxxx', $result['phone']);
30
        $this->assertSame('xxxxxxxxxxx', $result['code']);
31
        $this->assertSame('d04b98f48e8f8bcc15c6ae5ac050801cd6dcfd428fb5f9e65c4e16e7807340fa', $result['hash']);
32
        $this->assertSame('SHA256', $result['hash_algorithm']);
33
        $this->assertSame('RSA', $result['encryption']);
34
        $this->assertSame('Test message', $result['message']);
35
        $this->assertSame('EN', $result['language']);
36
    }
37
38
    public function testGetAction()
39
    {
40
        $this->assertSame('mobile/sign/hash', $this->method->getAction());
41
    }
42
43
    public function testGetMethod()
44
    {
45
        $this->assertSame(QueryInterface::POST, $this->method->getMethod());
46
    }
47
48
    public function testCreateResult()
49
    {
50
        $this->assertInstanceOf('Isign\Sign\MobileHashResult', $this->method->createResult());
51
    }
52
53
    public function testHasValidationConstraints()
54
    {
55
        $collection = $this->method->getValidationConstraints();
56
57
        $this->assertInstanceOf(
58
            'Symfony\Component\Validator\Constraints\Collection',
59
            $collection
60
        );
61
    }
62
}
63