Issues (220)

spec/Action/NotifyActionSpec.php (11 issues)

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\NotifyAction;
16
use BitBag\SyliusMolliePlugin\Client\MollieApiClient;
17
use BitBag\SyliusMolliePlugin\Repository\SubscriptionRepositoryInterface;
18
use Mollie\Api\Endpoints\PaymentEndpoint;
19
use Payum\Core\Action\ActionInterface;
20
use Payum\Core\ApiAwareInterface;
21
use Payum\Core\GatewayAwareInterface;
22
use Payum\Core\GatewayInterface;
23
use Payum\Core\Request\GetHttpRequest;
24
use Payum\Core\Request\Notify;
25
use PhpSpec\ObjectBehavior;
26
27
final class NotifyActionSpec extends ObjectBehavior
28
{
29
    function let(GetHttpRequest $getHttpRequest, SubscriptionRepositoryInterface $subscriptionRepository): void
0 ignored issues
show
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...
30
    {
31
        $this->beConstructedWith($getHttpRequest, $subscriptionRepository);
32
    }
33
34
    function it_is_initializable(): void
0 ignored issues
show
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...
35
    {
36
        $this->shouldHaveType(NotifyAction::class);
37
    }
38
39
    function it_implements_action_interface(): void
40
    {
41
        $this->shouldHaveType(ActionInterface::class);
42
    }
43
44
    function it_implements_api_aware_interface(): void
45
    {
46
        $this->shouldHaveType(ApiAwareInterface::class);
47
    }
48
49
    function it_implements_gateway_aware_interface(): void
50
    {
51
        $this->shouldHaveType(GatewayAwareInterface::class);
52
    }
53
54
    function it_executes(
55
        Notify $request,
56
        \ArrayObject $arrayObject,
57
        GatewayInterface $gateway,
58
        GetHttpRequest $getHttpRequest,
59
        MollieApiClient $mollieApiClient,
60
        PaymentEndpoint $paymentEndpoint
61
    ): void {
62
        $this->setGateway($gateway);
0 ignored issues
show
The method setGateway() does not exist on spec\BitBag\SyliusMollie...Action\NotifyActionSpec. 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

62
        $this->/** @scrutinizer ignore-call */ 
63
               setGateway($gateway);
Loading history...
63
64
        $this->setApi($mollieApiClient);
0 ignored issues
show
The method setApi() does not exist on spec\BitBag\SyliusMollie...Action\NotifyActionSpec. 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

64
        $this->/** @scrutinizer ignore-call */ 
65
               setApi($mollieApiClient);
Loading history...
65
        $getHttpRequest->request = ['id' => 1];
66
        $request->getModel()->willReturn($arrayObject);
67
        $payment = \Mockery::mock('payment');
68
        $payment->id = 1;
0 ignored issues
show
Accessing id on the interface Mockery\MockInterface suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
Accessing id on the interface Mockery\LegacyMockInterface suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
69
        $payment->metadata = (object) [
0 ignored issues
show
Accessing metadata on the interface Mockery\MockInterface suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
Accessing metadata on the interface Mockery\LegacyMockInterface suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
70
            'order_id' => 1,
71
        ];
72
        $payment->shouldReceive('getCheckoutUrl')->andReturn('');
73
        $paymentEndpoint->get(1)->willReturn($payment);
0 ignored issues
show
The method willReturn() does not exist on Mollie\Api\Resources\Payment. ( Ignorable by Annotation )

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

73
        $paymentEndpoint->get(1)->/** @scrutinizer ignore-call */ willReturn($payment);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
74
        $mollieApiClient->payments = $paymentEndpoint;
75
76
        $this->execute($request);
0 ignored issues
show
The method execute() does not exist on spec\BitBag\SyliusMollie...Action\NotifyActionSpec. 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

76
        $this->/** @scrutinizer ignore-call */ 
77
               execute($request);
Loading history...
77
    }
78
79
    function it_supports_only_notify_request_and_array_access(
80
        Notify $request,
81
        \ArrayAccess $arrayAccess
82
    ): void {
83
        $request->getModel()->willReturn($arrayAccess);
84
85
        $this->supports($request)->shouldReturn(true);
0 ignored issues
show
The method supports() does not exist on spec\BitBag\SyliusMollie...Action\NotifyActionSpec. 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

85
        $this->/** @scrutinizer ignore-call */ 
86
               supports($request)->shouldReturn(true);
Loading history...
86
    }
87
}
88