CaptureActionTest::shouldCallDoPayment()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
dl 0
loc 12
rs 9.9666
c 1
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace PTS\Paysera\Tests\Action;
4
5
use Payum\Core\ApiAwareInterface;
6
use Payum\Core\GatewayAwareInterface;
7
use Payum\Core\Request\Capture;
8
use Payum\Core\Tests\GenericActionTest;
9
use PTS\Paysera\Action\CaptureAction;
10
use PTS\Paysera\Api;
11
12
class CaptureActionTest extends GenericActionTest
13
{
14
    protected $requestClass = Capture::class;
15
16
    protected $actionClass = CaptureAction::class;
17
18
    /**
19
     * @test
20
     */
21
    public function shouldImplementsApiAwareInterface()
22
    {
23
        $rc = new \ReflectionClass(CaptureAction::class);
24
        $this->assertTrue($rc->isSubclassOf(ApiAwareInterface::class));
25
    }
26
27
    /** @test */
28
    public function shouldImplementsGatewayAwareInterface()
29
    {
30
        $rc = new \ReflectionClass(CaptureAction::class);
31
        $this->assertTrue($rc->isSubclassOf(GatewayAwareInterface::class));
32
    }
33
34
    /**
35
     * @test
36
     */
37
    public function shouldCallDoPayment()
38
    {
39
        $apiMock = $this->createMock(Api::class);
40
        $action = new CaptureAction();
41
        $gateway = $this->createGatewayMock();
42
        $apiMock
43
            ->expects($this->once())
44
            ->method('doPayment')
45
        ;
46
        $action->setGateway($gateway);
47
        $action->setApi($apiMock);
48
        $action->execute(new Capture([]));
49
    }
50
51
    /**
52
     * @test
53
     */
54
    public function couldBeConstructedWithoutAnyArguments()
55
    {
56
        $this->expectNotToPerformAssertions();
57
        new $this->actionClass();
58
    }
59
}