Passed
Branch develop (84afed)
by Paulius
02:35
created

SignTest::testCreateResult()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
namespace Dokobit\Gateway\Tests\Query\Signing;
3
4
use Dokobit\Gateway\Query\Signing\Sign;
5
use Dokobit\Gateway\Query\QueryInterface;
6
use Dokobit\Gateway\Tests\TestCase;
7
8
class SignTest extends TestCase
9
{
10
    const TOKEN = 'SigningToken';
11
    const SIGNER_ID = 'ThisSignerId';
12
    const SIGNATURE_VALUE = 'MFs8jeKFZCd9zUyHFXvm==';
13
14
    /** @var Sign */
15
    private $query;
16
17
    protected function setUp(): void
18
    {
19
        $this->query = new Sign(
20
            self::TOKEN,
21
            self::SIGNER_ID,
22
            self::SIGNATURE_VALUE
23
        );
24
    }
25
26
    public function testGetFields()
27
    {
28
        $fields = $this->query->getFields();
29
30
        $this->assertArrayHasKey('token', $fields);
31
        $this->assertArrayHasKey('signer_id', $fields);
32
        $this->assertArrayHasKey('signature_value', $fields);
33
34
        $this->assertSame(self::TOKEN, $fields['token']);
35
        $this->assertSame(self::SIGNER_ID, $fields['signer_id']);
36
        $this->assertSame(self::SIGNATURE_VALUE, $fields['signature_value']);
37
    }
38
39
    public function testGetAction()
40
    {
41
        $this->assertSame('signing/'.self::TOKEN.'/sign', $this->query->getAction());
42
    }
43
44
    public function testGetMethod()
45
    {
46
        $this->assertSame(QueryInterface::POST, $this->query->getMethod());
47
    }
48
49
    public function testCreateResult()
50
    {
51
        $this->assertInstanceOf('Dokobit\Gateway\Result\Signing\SignResult', $this->query->createResult());
52
    }
53
54
    public function testHasValidationConstraints()
55
    {
56
        $collection = $this->query->getValidationConstraints();
57
58
        $this->assertInstanceOf(
59
            'Symfony\Component\Validator\Constraints\Collection',
60
            $collection
61
        );
62
    }
63
}
64