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

CreateBatchTest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 6
eloc 28
dl 0
loc 60
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetMethod() 0 3 1
A testCreateBatchResult() 0 3 1
A testHasValidationConstraints() 0 7 1
A testGetAction() 0 3 1
A setUp() 0 6 1
A testGetFields() 0 16 1
1
<?php
2
namespace Dokobit\Gateway\Tests\Query\Signing;
3
4
use Dokobit\Gateway\Query\Signing\CreateBatch;
5
use Dokobit\Gateway\Query\QueryInterface;
6
use Dokobit\Gateway\Tests\TestCase;
7
8
class CreateBatchTest extends TestCase
9
{
10
    const SIGNING_TOKEN_1 = 'signing1';
11
    const SIGNING_TOKEN_2 = 'signing2';
12
    const SIGNER_TOKEN_1 = 'signer1';
13
    const SIGNER_TOKEN_2 = 'signer2';
14
15
    /** @var CreateBatch */
16
    private $query;
17
18
    protected function setUp(): void
19
    {
20
        $this->query = new CreateBatch(
21
            [
22
                ['token' => self::SIGNING_TOKEN_1, 'signer_token' => self::SIGNER_TOKEN_1],
23
                ['token' => self::SIGNING_TOKEN_2, 'signer_token' => self::SIGNER_TOKEN_2],
24
            ]
25
        );
26
    }
27
28
    public function testGetFields()
29
    {
30
        $fields = $this->query->getFields();
31
32
        $this->assertArrayHasKey('signings', $fields);
33
        $this->assertArrayHasKey(0, $fields['signings']);
34
        $this->assertArrayHasKey(1, $fields['signings']);
35
        $this->assertArrayHasKey('token', $fields['signings'][0]);
36
        $this->assertArrayHasKey('signer_token', $fields['signings'][0]);
37
        $this->assertArrayHasKey('token', $fields['signings'][1]);
38
        $this->assertArrayHasKey('signer_token', $fields['signings'][1]);
39
40
        $this->assertSame(self::SIGNING_TOKEN_1, $fields['signings'][0]['token']);
41
        $this->assertSame(self::SIGNER_TOKEN_1, $fields['signings'][0]['signer_token']);
42
        $this->assertSame(self::SIGNING_TOKEN_2, $fields['signings'][1]['token']);
43
        $this->assertSame(self::SIGNER_TOKEN_2, $fields['signings'][1]['signer_token']);
44
    }
45
46
    public function testGetAction()
47
    {
48
        $this->assertSame('signing/createbatch', $this->query->getAction());
49
    }
50
51
    public function testGetMethod()
52
    {
53
        $this->assertSame(QueryInterface::POST, $this->query->getMethod());
54
    }
55
56
    public function testCreateBatchResult()
57
    {
58
        $this->assertInstanceOf('Dokobit\Gateway\Result\Signing\CreateBatchResult', $this->query->createResult());
59
    }
60
61
    public function testHasValidationConstraints()
62
    {
63
        $collection = $this->query->getValidationConstraints();
64
65
        $this->assertInstanceOf(
66
            'Symfony\Component\Validator\Constraints\Collection',
67
            $collection
68
        );
69
    }
70
}
71