shouldBeSubClassOfGatewayAwareAction()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
4
namespace PTS\Paysera\Tests\Action;
5
6
7
use Payum\Core\Request\GetHumanStatus;
8
use Payum\Core\Tests\GenericActionTest;
9
use PTS\Paysera\Action\StatusAction;
10
11
class StatusActionTest extends GenericActionTest
12
{
13
14
    protected $requestClass = 'Payum\Core\Request\GetHumanStatus';
15
    protected $actionClass = StatusAction::class;
16
17
    /**
18
     * @test
19
     */
20
    public function shouldBeSubClassOfGatewayAwareAction()
21
    {
22
        $rc = new \ReflectionClass(StatusAction::class);
23
        $this->assertTrue($rc->implementsInterface('Payum\Core\Action\ActionInterface'));
24
    }
25
26
    /**
27
     * @test
28
     */
29
    public function shouldMarkAsNew()
30
    {
31
        $request = new GetHumanStatus(array(
32
            'status' => 'NEW'
33
        ));
34
        $action = new StatusAction();
35
        $action->execute($request);
36
        $this->assertTrue($request->isNew(), 'Request should be marked as new');
37
    }
38
39
    /**
40
     * @test
41
     */
42
    public function shouldMarkAsPending()
43
    {
44
        $request = new GetHumanStatus(array(
45
            'status' => 'FAILED'
46
        ));
47
        $action = new StatusAction();
48
        $action->execute($request);
49
        $this->assertTrue($request->isFailed(), 'Request should be marked as failed');
50
    }
51
52
    /**
53
     * @test
54
     */
55
    public function shouldMarkAsCaptured()
56
    {
57
        $request = new GetHumanStatus(array(
58
            'status' => 'COMPLETED'
59
        ));
60
        $action = new StatusAction();
61
        $action->execute($request);
62
        $this->assertTrue($request->isCaptured(), 'Request should be marked as captured');
63
    }
64
65
    /**
66
     * @test
67
     */
68
    public function couldBeConstructedWithoutAnyArguments()
69
    {
70
        $this->expectNotToPerformAssertions();
71
        new $this->actionClass();
72
    }
73
}
74