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
|
|
|
|