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

CreateBatchTest::testGetMethod()   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\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