Issues (220)

Api/CancelRecurringSubscriptionActionSpec.php (6 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\Api;
14
15
use BitBag\SyliusMolliePlugin\Action\Api\BaseApiAwareAction;
16
use BitBag\SyliusMolliePlugin\Action\Api\CancelRecurringSubscriptionAction;
17
use BitBag\SyliusMolliePlugin\Client\MollieApiClient;
18
use BitBag\SyliusMolliePlugin\Entity\SubscriptionInterface;
19
use BitBag\SyliusMolliePlugin\Request\Api\CancelRecurringSubscription;
20
use Mollie\Api\Endpoints\CustomerEndpoint;
21
use Mollie\Api\Resources\Customer;
22
use Payum\Core\Action\ActionInterface;
23
use Payum\Core\ApiAwareInterface;
24
use PhpSpec\ObjectBehavior;
25
26
final class CancelRecurringSubscriptionActionSpec extends ObjectBehavior
27
{
28
    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...
29
    {
30
        $this->shouldHaveType(CancelRecurringSubscriptionAction::class);
31
    }
32
33
    function it_implements_action_interface(): void
34
    {
35
        $this->shouldHaveType(ActionInterface::class);
36
    }
37
38
    function it_implements_api_aware_interface(): void
39
    {
40
        $this->shouldHaveType(ApiAwareInterface::class);
41
    }
42
43
    function it_extends_base_api_aware(): void
44
    {
45
        $this->shouldHaveType(BaseApiAwareAction::class);
46
    }
47
48
    function it_executes(
49
        CancelRecurringSubscription $request,
50
        MollieApiClient $mollieApiClient,
51
        SubscriptionInterface $subscription,
52
        CustomerEndpoint $customerEndpoint,
53
        Customer $customer
54
    ): void {
55
        $mollieApiClient->customers = $customerEndpoint;
56
        $this->setApi($mollieApiClient);
0 ignored issues
show
The method setApi() does not exist on spec\BitBag\SyliusMollie...gSubscriptionActionSpec. 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

56
        $this->/** @scrutinizer ignore-call */ 
57
               setApi($mollieApiClient);
Loading history...
57
        $customerEndpoint->get('id_1')->willReturn($customer);
0 ignored issues
show
The method willReturn() does not exist on Mollie\Api\Resources\Customer. ( Ignorable by Annotation )

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

57
        $customerEndpoint->get('id_1')->/** @scrutinizer ignore-call */ willReturn($customer);

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...
58
        $subscription->getSubscriptionId()->willReturn('id_1');
59
        $subscription->getCustomerId()->willReturn('id_1');
60
        $request->getModel()->willReturn($subscription);
61
62
        $customer->cancelSubscription('id_1')->shouldBeCalled();
0 ignored issues
show
Are you sure the usage of $customer->cancelSubscription('id_1') targeting Mollie\Api\Resources\Cus...r::cancelSubscription() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
63
64
        $this->execute($request);
0 ignored issues
show
The method execute() does not exist on spec\BitBag\SyliusMollie...gSubscriptionActionSpec. 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
               execute($request);
Loading history...
65
    }
66
67
    function it_supports_cancel_recurring_subscription_request_and_subscription_model(
68
        CancelRecurringSubscription $request,
69
        SubscriptionInterface $subscription
70
    ): void {
71
        $request->getModel()->willReturn($subscription);
72
73
        $this->supports($request)->shouldReturn(true);
0 ignored issues
show
The method supports() does not exist on spec\BitBag\SyliusMollie...gSubscriptionActionSpec. 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

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