CaptureActionTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 18
dl 0
loc 46
rs 10
c 1
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A shouldImplementsApiAwareInterface() 0 4 1
A couldBeConstructedWithoutAnyArguments() 0 4 1
A shouldCallDoPayment() 0 12 1
A shouldImplementsGatewayAwareInterface() 0 4 1
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
}