CancelRecurringSubscriptionProcessorSpec   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 13
dl 0
loc 42
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A it_implements_cancel_recurring_subscription_processor_interface() 0 3 1
A it_is_initializable() 0 3 1
A let() 0 3 1
A it_processes() 0 25 1
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\PaymentProcessing;
14
15
use BitBag\SyliusMolliePlugin\Entity\SubscriptionInterface;
16
use BitBag\SyliusMolliePlugin\MollieSubscriptionGatewayFactory;
0 ignored issues
show
Bug introduced by
The type BitBag\SyliusMolliePlugi...scriptionGatewayFactory was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
use BitBag\SyliusMolliePlugin\PaymentProcessing\CancelRecurringSubscriptionProcessor;
18
use BitBag\SyliusMolliePlugin\PaymentProcessing\CancelRecurringSubscriptionProcessorInterface;
19
use Payum\Core\GatewayInterface;
20
use Payum\Core\Model\GatewayConfigInterface;
21
use Payum\Core\Payum;
22
use PhpSpec\ObjectBehavior;
23
use Prophecy\Argument;
24
use Sylius\Component\Core\Model\OrderInterface;
25
use Sylius\Component\Core\Model\PaymentInterface;
26
use Sylius\Component\Core\Model\PaymentMethodInterface;
27
use Symfony\Component\HttpFoundation\Session\Session;
28
29
final class CancelRecurringSubscriptionProcessorSpec extends ObjectBehavior
30
{
31
    function let(Payum $payum, Session $session): 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...
32
    {
33
        $this->beConstructedWith($payum, $session);
34
    }
35
36
    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...
37
    {
38
        $this->shouldHaveType(CancelRecurringSubscriptionProcessor::class);
39
    }
40
41
    function it_implements_cancel_recurring_subscription_processor_interface(): void
42
    {
43
        $this->shouldHaveType(CancelRecurringSubscriptionProcessorInterface::class);
44
    }
45
46
    function it_processes(
47
        SubscriptionInterface $subscription,
48
        OrderInterface $order,
49
        PaymentInterface $payment,
50
        PaymentMethodInterface $paymentMethod,
51
        GatewayConfigInterface $gatewayConfig,
52
        Payum $payum,
53
        GatewayInterface $gateway
54
    ): void {
55
        $gatewayConfig->getFactoryName()->willReturn(MollieSubscriptionGatewayFactory::FACTORY_NAME);
0 ignored issues
show
Deprecated Code introduced by
The function Payum\Core\Model\Gateway...rface::getFactoryName() has been deprecated: since 1.3.3 will be removed in 2.0. set factory option inside the config ( Ignorable by Annotation )

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

55
        /** @scrutinizer ignore-deprecated */ $gatewayConfig->getFactoryName()->willReturn(MollieSubscriptionGatewayFactory::FACTORY_NAME);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
56
        $gatewayConfig->getGatewayName()->willReturn(MollieSubscriptionGatewayFactory::FACTORY_NAME);
57
58
        $paymentMethod->getGatewayConfig()->willReturn($gatewayConfig);
0 ignored issues
show
Bug introduced by
The method willReturn() does not exist on Payum\Core\Model\GatewayConfigInterface. ( Ignorable by Annotation )

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

58
        $paymentMethod->getGatewayConfig()->/** @scrutinizer ignore-call */ willReturn($gatewayConfig);

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...
59
60
        $payment->getMethod()->willReturn($paymentMethod);
0 ignored issues
show
Bug introduced by
The method willReturn() does not exist on Sylius\Component\Payment...\PaymentMethodInterface. ( Ignorable by Annotation )

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

60
        $payment->getMethod()->/** @scrutinizer ignore-call */ willReturn($paymentMethod);

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...
61
62
        $order->getLastPayment()->willReturn($payment);
0 ignored issues
show
Bug introduced by
The method willReturn() does not exist on Sylius\Component\Core\Model\PaymentInterface. ( Ignorable by Annotation )

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

62
        $order->getLastPayment()->/** @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...
63
64
        $subscription->getOrder()->willReturn($order);
0 ignored issues
show
Bug introduced by
The method willReturn() does not exist on Sylius\Component\Core\Model\OrderInterface. ( Ignorable by Annotation )

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

64
        $subscription->getOrder()->/** @scrutinizer ignore-call */ willReturn($order);

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...
65
66
        $payum->getGateway(MollieSubscriptionGatewayFactory::FACTORY_NAME)->willReturn($gateway);
0 ignored issues
show
Bug introduced by
The method willReturn() does not exist on Payum\Core\GatewayInterface. ( Ignorable by Annotation )

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

66
        $payum->getGateway(MollieSubscriptionGatewayFactory::FACTORY_NAME)->/** @scrutinizer ignore-call */ willReturn($gateway);

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...
67
68
        $gateway->execute(Argument::any())->shouldBeCalled();
0 ignored issues
show
Bug introduced by
The method shouldBeCalled() does not exist on Payum\Core\Reply\ReplyInterface. ( Ignorable by Annotation )

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

68
        $gateway->execute(Argument::any())->/** @scrutinizer ignore-call */ shouldBeCalled();

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...
69
70
        $this->process($subscription);
0 ignored issues
show
Bug introduced by
The method process() does not exist on spec\BitBag\SyliusMollie...bscriptionProcessorSpec. 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

70
        $this->/** @scrutinizer ignore-call */ 
71
               process($subscription);
Loading history...
71
    }
72
}
73