Completed
Push — develop ( d0e808...84afed )
by
unknown
17s queued 14s
created

AddSignerTest::testGetAction()   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\AddSigner;
5
use Dokobit\Gateway\Query\QueryInterface;
6
use Dokobit\Gateway\Tests\TestCase;
7
8
class AddSignerTest extends TestCase
9
{
10
    const TOKEN = 'UploadedFileToken';
11
    const SIGNER_ID = 'RandomNotReally';
12
    const SIGNER_NAME = 'Kraft';
13
    const SIGNER_SURNAME = 'Lawrence';
14
    const SIGNER_CODE = '51001091072';
15
    const SIGNER_PHONE = '+37060000007';
16
17
    /** @var Archive */
18
    private $query;
19
20
    protected function setUp(): void
21
    {
22
        $this->query = new AddSigner(
0 ignored issues
show
Documentation Bug introduced by
It seems like new Dokobit\Gateway\Quer...> self::SIGNER_PHONE))) of type Dokobit\Gateway\Query\Signing\AddSigner is incompatible with the declared type Dokobit\Gateway\Tests\Query\Signing\Archive of property $query.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
23
            self::TOKEN,
24
            [
25
                [
26
                    'id' => self::SIGNER_ID,
27
                    'name' => self::SIGNER_NAME,
28
                    'surname' => self::SIGNER_SURNAME,
29
                    'code' => self::SIGNER_CODE,
30
                    'phone' => self::SIGNER_PHONE,
31
                ],
32
            ]
33
        );
34
    }
35
36
    public function testGetFields()
37
    {
38
        $fields = $this->query->getFields();
39
40
        $this->assertArrayHasKey('token', $fields);
41
        $this->assertArrayHasKey('signers', $fields);
42
43
        $this->assertArrayHasKey(0, $fields['signers']);
44
45
        $this->assertArrayHasKey('id', $fields['signers'][0]);
46
        $this->assertArrayHasKey('name', $fields['signers'][0]);
47
        $this->assertArrayHasKey('surname', $fields['signers'][0]);
48
        $this->assertArrayHasKey('code', $fields['signers'][0]);
49
        $this->assertArrayHasKey('phone', $fields['signers'][0]);
50
51
        $this->assertSame(self::TOKEN, $fields['token']);
52
        $this->assertSame(self::SIGNER_ID, $fields['signers'][0]['id']);
53
        $this->assertSame(self::SIGNER_NAME, $fields['signers'][0]['name']);
54
        $this->assertSame(self::SIGNER_SURNAME, $fields['signers'][0]['surname']);
55
        $this->assertSame(self::SIGNER_CODE, $fields['signers'][0]['code']);
56
        $this->assertSame(self::SIGNER_PHONE, $fields['signers'][0]['phone']);
57
    }
58
59
    public function testGetAction()
60
    {
61
        $this->assertSame('signing/'.self::TOKEN.'/addsigner', $this->query->getAction());
62
    }
63
64
    public function testGetMethod()
65
    {
66
        $this->assertSame(QueryInterface::POST, $this->query->getMethod());
67
    }
68
69
    public function testCreateResult()
70
    {
71
        $this->assertInstanceOf('Dokobit\Gateway\Result\Signing\AddSignerResult', $this->query->createResult());
72
    }
73
74
    public function testHasValidationConstraints()
75
    {
76
        $collection = $this->query->getValidationConstraints();
77
78
        $this->assertInstanceOf(
79
            'Symfony\Component\Validator\Constraints\Collection',
80
            $collection
81
        );
82
    }
83
}
84