|
1
|
|
|
<?php |
|
2
|
|
|
namespace Dokobit\Gateway\Tests\Query\Signing; |
|
3
|
|
|
|
|
4
|
|
|
use Dokobit\Gateway\Query\Signing\RemoveSigner; |
|
5
|
|
|
use Dokobit\Gateway\Query\QueryInterface; |
|
6
|
|
|
use Dokobit\Gateway\Tests\TestCase; |
|
7
|
|
|
|
|
8
|
|
|
class RemoveSignerTest extends TestCase |
|
9
|
|
|
{ |
|
10
|
|
|
const TOKEN = 'UploadedFileToken'; |
|
11
|
|
|
const SIGNER_ID = 'RandomNotReally'; |
|
12
|
|
|
|
|
13
|
|
|
/** @var RemoveSigner */ |
|
14
|
|
|
private $query; |
|
15
|
|
|
|
|
16
|
|
|
protected function setUp(): void |
|
17
|
|
|
{ |
|
18
|
|
|
$this->query = new RemoveSigner( |
|
19
|
|
|
self::TOKEN, |
|
20
|
|
|
[ |
|
21
|
|
|
[ |
|
22
|
|
|
'id' => self::SIGNER_ID, |
|
23
|
|
|
], |
|
24
|
|
|
] |
|
25
|
|
|
); |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
public function testGetFields() |
|
29
|
|
|
{ |
|
30
|
|
|
$fields = $this->query->getFields(); |
|
31
|
|
|
|
|
32
|
|
|
$this->assertArrayHasKey('token', $fields); |
|
33
|
|
|
$this->assertArrayHasKey('signers', $fields); |
|
34
|
|
|
|
|
35
|
|
|
$this->assertArrayHasKey(0, $fields['signers']); |
|
36
|
|
|
|
|
37
|
|
|
$this->assertArrayHasKey('id', $fields['signers'][0]); |
|
38
|
|
|
|
|
39
|
|
|
$this->assertSame(self::TOKEN, $fields['token']); |
|
40
|
|
|
$this->assertSame(self::SIGNER_ID, $fields['signers'][0]['id']); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
public function testGetAction() |
|
44
|
|
|
{ |
|
45
|
|
|
$this->assertSame('signing/'.self::TOKEN.'/removesigner', $this->query->getAction()); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
public function testGetMethod() |
|
49
|
|
|
{ |
|
50
|
|
|
$this->assertSame(QueryInterface::POST, $this->query->getMethod()); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
public function testCreateResult() |
|
54
|
|
|
{ |
|
55
|
|
|
$this->assertInstanceOf('Dokobit\Gateway\Result\Signing\RemoveSignerResult', $this->query->createResult()); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
public function testHasValidationConstraints() |
|
59
|
|
|
{ |
|
60
|
|
|
$collection = $this->query->getValidationConstraints(); |
|
61
|
|
|
|
|
62
|
|
|
$this->assertInstanceOf( |
|
63
|
|
|
'Symfony\Component\Validator\Constraints\Collection', |
|
64
|
|
|
$collection |
|
65
|
|
|
); |
|
66
|
|
|
} |
|
67
|
|
|
} |
|
68
|
|
|
|