RefundActionSpec::it_is_initializable()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file has been created by developers from BitBag.
5
 * Feel free to contact us once you face any issues or want to start
6
 * another great project.
7
 * You can find more information about us on https://bitbag.shop and write us
8
 * an email on [email protected].
9
 */
10
11
declare(strict_types=1);
12
13
namespace spec\BitBag\SyliusMolliePlugin\Action;
14
15
use BitBag\SyliusMolliePlugin\Action\RefundAction;
16
use BitBag\SyliusMolliePlugin\Client\MollieApiClient;
17
use Payum\Core\Action\ActionInterface;
18
use Payum\Core\ApiAwareInterface;
19
use Payum\Core\Bridge\Spl\ArrayObject;
20
use Payum\Core\GatewayAwareInterface;
21
use Payum\Core\GatewayInterface;
22
use Payum\Core\Request\Refund;
23
use PhpSpec\ObjectBehavior;
24
25
final class RefundActionSpec extends ObjectBehavior
26
{
27
    function it_is_initializable(): void
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
28
    {
29
        $this->shouldHaveType(RefundAction::class);
30
    }
31
32
    function it_implements_action_interface(): void
33
    {
34
        $this->shouldHaveType(ActionInterface::class);
35
    }
36
37
    function it_implements_api_aware_interface(): void
38
    {
39
        $this->shouldHaveType(ApiAwareInterface::class);
40
    }
41
42
    function it_implements_gateway_aware_interface(): void
43
    {
44
        $this->shouldHaveType(GatewayAwareInterface::class);
45
    }
46
47
    function it_executes(
48
        Refund $request,
49
        GatewayInterface $gateway,
50
        MollieApiClient $mollieApiClient
51
    ): void {
52
        $this->setGateway($gateway);
0 ignored issues
show
Bug introduced by
The method setGateway() does not exist on spec\BitBag\SyliusMollie...Action\RefundActionSpec. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

52
        $this->/** @scrutinizer ignore-call */ 
53
               setGateway($gateway);
Loading history...
53
        $this->setApi($mollieApiClient);
0 ignored issues
show
Bug introduced by
The method setApi() does not exist on spec\BitBag\SyliusMollie...Action\RefundActionSpec. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

53
        $this->/** @scrutinizer ignore-call */ 
54
               setApi($mollieApiClient);
Loading history...
54
        $arrayObject = new ArrayObject(['payment_mollie_id' => 1]);
55
        $request->getModel()->willReturn($arrayObject);
56
        $payment = \Mockery::mock('payment');
57
        $payment->shouldReceive('canBeRefunded')->andReturn(true);
58
        $payment->shouldReceive('refund')->andReturn(true);
59
        $payment->shouldReceive('get')->andReturn($payment);
60
61
        $mollieApiClient->payments = $payment;
0 ignored issues
show
Documentation Bug introduced by
It seems like $payment of type Mockery\LegacyMockInterface or Mockery\MockInterface is incompatible with the declared type Mollie\Api\Endpoints\PaymentEndpoint of property $payments.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
62
63
        $this->execute($request);
0 ignored issues
show
Bug introduced by
The method execute() does not exist on spec\BitBag\SyliusMollie...Action\RefundActionSpec. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

63
        $this->/** @scrutinizer ignore-call */ 
64
               execute($request);
Loading history...
64
    }
65
66
    function it_supports_only_refund_request_and_array_access(
67
        Refund $request,
68
        \ArrayAccess $arrayAccess
69
    ): void {
70
        $request->getModel()->willReturn($arrayAccess);
71
72
        $this->supports($request)->shouldReturn(true);
0 ignored issues
show
Bug introduced by
The method supports() does not exist on spec\BitBag\SyliusMollie...Action\RefundActionSpec. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

72
        $this->/** @scrutinizer ignore-call */ 
73
               supports($request)->shouldReturn(true);
Loading history...
73
    }
74
}
75