Issues (220)

spec/Action/StatusActionSpec.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;
14
15
use BitBag\SyliusMolliePlugin\Action\StatusAction;
16
use BitBag\SyliusMolliePlugin\Client\MollieApiClient;
17
use Payum\Core\Action\ActionInterface;
18
use Payum\Core\ApiAwareInterface;
19
use Payum\Core\GatewayAwareInterface;
20
use Payum\Core\GatewayInterface;
21
use Payum\Core\Request\GetStatusInterface;
22
use PhpSpec\ObjectBehavior;
23
use Sylius\Component\Core\Model\PaymentInterface;
24
25
final class StatusActionSpec extends ObjectBehavior
26
{
27
    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...
28
    {
29
        $this->shouldHaveType(StatusAction::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
        GetStatusInterface $request,
49
        PaymentInterface $payment,
50
        GatewayInterface $gateway,
51
        MollieApiClient $mollieApiClient
52
    ): void {
53
        $this->setApi($mollieApiClient);
0 ignored issues
show
The method setApi() does not exist on spec\BitBag\SyliusMollie...Action\StatusActionSpec. 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
        $this->setGateway($gateway);
0 ignored issues
show
The method setGateway() does not exist on spec\BitBag\SyliusMollie...Action\StatusActionSpec. 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

54
        $this->/** @scrutinizer ignore-call */ 
55
               setGateway($gateway);
Loading history...
55
        $payment->getDetails()->willReturn([]);
56
        $request->getModel()->willReturn($payment);
57
58
        $request->markNew()->shouldBeCalled();
0 ignored issues
show
Are you sure the usage of $request->markNew() targeting Payum\Core\Request\GetStatusInterface::markNew() 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...
59
60
        $this->execute($request);
0 ignored issues
show
The method execute() does not exist on spec\BitBag\SyliusMollie...Action\StatusActionSpec. 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

60
        $this->/** @scrutinizer ignore-call */ 
61
               execute($request);
Loading history...
61
    }
62
63
    function it_supports_only_get_status_request_and_array_access(
64
        GetStatusInterface $request,
65
        PaymentInterface $payment
66
    ): void {
67
        $request->getModel()->willReturn($payment);
68
69
        $this->supports($request)->shouldReturn(true);
0 ignored issues
show
The method supports() does not exist on spec\BitBag\SyliusMollie...Action\StatusActionSpec. 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

69
        $this->/** @scrutinizer ignore-call */ 
70
               supports($request)->shouldReturn(true);
Loading history...
70
    }
71
}
72