Passed
Branch develop (84afed)
by Paulius
02:35
created

DeleteTest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 6
eloc 15
dl 0
loc 45
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetAction() 0 3 1
A testHasValidationConstraints() 0 7 1
A testCreateResult() 0 3 1
A testGetFieldsPath() 0 7 1
A testGetMethod() 0 3 1
A setUp() 0 4 1
1
<?php
2
namespace Dokobit\Gateway\Tests\Query\File;
3
4
use Dokobit\Gateway\Query\File\Delete;
5
use Dokobit\Gateway\Query\QueryInterface;
6
use Dokobit\Gateway\Tests\TestCase;
7
8
class DeleteTest extends TestCase
9
{
10
    const TOKEN = 'UploadedFileToken';
11
12
    /** @var Delete */
13
    private $query;
14
15
    protected function setUp(): void
16
    {
17
        $this->query = new Delete(
18
            self::TOKEN
19
        );
20
    }
21
22
    public function testGetFieldsPath()
23
    {
24
        $fields = $this->query->getFields();
25
26
        $this->assertArrayHasKey('token', $fields);
27
28
        $this->assertSame(self::TOKEN, $fields['token']);
29
    }
30
31
    public function testGetAction()
32
    {
33
        $this->assertSame('file/'.self::TOKEN.'/delete', $this->query->getAction());
34
    }
35
36
    public function testGetMethod()
37
    {
38
        $this->assertSame(QueryInterface::POST, $this->query->getMethod());
39
    }
40
41
    public function testCreateResult()
42
    {
43
        $this->assertInstanceOf('Dokobit\Gateway\Result\File\DeleteResult', $this->query->createResult());
44
    }
45
46
    public function testHasValidationConstraints()
47
    {
48
        $collection = $this->query->getValidationConstraints();
49
50
        $this->assertInstanceOf(
51
            'Symfony\Component\Validator\Constraints\Collection',
52
            $collection
53
        );
54
    }
55
}
56