Completed
Push — pull-request/8055 ( ad3cfa )
by Kamil
26:24 queued 01:40
created

CapturePaymentActionSpec::it_is_initializable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace spec\Sylius\Bundle\PayumBundle\Action;
4
5
use Payum\Core\Action\GatewayAwareAction;
6
use Payum\Core\Bridge\Spl\ArrayObject;
7
use Payum\Core\GatewayInterface;
8
use Payum\Core\Request\Capture;
9
use PhpSpec\ObjectBehavior;
10
use Prophecy\Argument;
11
use Sylius\Bundle\PayumBundle\Action\CapturePaymentAction;
12
use Sylius\Bundle\PayumBundle\Provider\PaymentDescriptionProviderInterface;
13
use Sylius\Component\Core\Model\OrderInterface;
14
use Sylius\Component\Core\Model\PaymentInterface;
15
16
/**
17
 * @author Stefan Doorn <[email protected]>
18
 */
19
final class CapturePaymentActionSpec extends ObjectBehavior
20
{
21
    function let(PaymentDescriptionProviderInterface $paymentDescriptionProvider)
0 ignored issues
show
Comprehensibility Naming introduced by
The variable name $paymentDescriptionProvider exceeds the maximum configured length of 20.

Very long variable names usually make code harder to read. It is therefore recommended not to make variable names too verbose.

Loading history...
22
    {
23
        $this->beConstructedWith($paymentDescriptionProvider);
24
    }
25
26
    function it_is_initializable()
27
    {
28
        $this->shouldHaveType(CapturePaymentAction::class);
29
    }
30
31
    function it_extends_gateway_aware_action()
32
    {
33
        $this->shouldHaveType(GatewayAwareAction::class);
34
    }
35
36
    function it_should_throw_exception_when_unsupported_request(Capture $capture)
37
    {
38
        $this->shouldThrow('\Payum\Core\Exception\RequestNotSupportedException')->duringExecute($capture);
39
    }
40
41
    function it_should_perform_basic_capture(
42
        PaymentDescriptionProviderInterface $paymentDescriptionProvider,
0 ignored issues
show
Unused Code introduced by
The parameter $paymentDescriptionProvider is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Comprehensibility Naming introduced by
The variable name $paymentDescriptionProvider exceeds the maximum configured length of 20.

Very long variable names usually make code harder to read. It is therefore recommended not to make variable names too verbose.

Loading history...
43
        GatewayInterface $gateway,
44
        Capture $capture,
45
        PaymentInterface $payment,
46
        OrderInterface $order
47
    ) {
48
        $this->setGateway($gateway);
49
50
        $payment->getOrder()->willReturn($order);
51
        $payment->getDetails()->willReturn([]);
52
        $capture->getModel()->willReturn($payment);
53
54
        $payment->setDetails([])->shouldBeCalled();
55
        $capture->setModel(new ArrayObject())->shouldBeCalled();
56
57
        $this->execute($capture);
58
    }
59
}
60