OrderAmountValidatorSpec::let()   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
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 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\SyliusQuadPayPlugin\Validator\Constraints;
14
15
use BitBag\SyliusQuadPayPlugin\QuadPayGatewayFactory;
16
use BitBag\SyliusQuadPayPlugin\Validator\Constraints\OrderAmount;
17
use BitBag\SyliusQuadPayPlugin\Validator\Constraints\OrderAmountValidator;
18
use Payum\Core\Model\GatewayConfigInterface;
19
use PhpSpec\ObjectBehavior;
20
use Sylius\Component\Core\Model\PaymentInterface;
21
use Sylius\Component\Core\Model\PaymentMethodInterface;
22
use Symfony\Component\Validator\ConstraintValidator;
23
use Symfony\Component\Validator\Context\ExecutionContextInterface;
24
25
final class OrderAmountValidatorSpec extends ObjectBehavior
26
{
27
    function let(ExecutionContextInterface $executionContextInterface): 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->initialize($executionContextInterface);
0 ignored issues
show
Bug introduced by
The method initialize() does not exist on spec\BitBag\SyliusQuadPa...rderAmountValidatorSpec. 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

29
        $this->/** @scrutinizer ignore-call */ 
30
               initialize($executionContextInterface);
Loading history...
30
    }
31
32
    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...
33
    {
34
        $this->shouldHaveType(OrderAmountValidator::class);
35
    }
36
37
    function it_extends_constraint_validator_class(): void
38
    {
39
        $this->shouldHaveType(ConstraintValidator::class);
40
    }
41
42
    function it_validates(
43
        PaymentMethodInterface $paymentMethod,
44
        GatewayConfigInterface $gatewayConfig,
45
        PaymentInterface $payment
46
    ): void {
47
        $orderAmountConstraint = new OrderAmount();
48
        $gatewayConfig->getFactoryName()->willReturn(QuadPayGatewayFactory::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

48
        /** @scrutinizer ignore-deprecated */ $gatewayConfig->getFactoryName()->willReturn(QuadPayGatewayFactory::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...
49
        $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

49
        $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...
50
51
        $this->validate($payment, $orderAmountConstraint);
0 ignored issues
show
Bug introduced by
The method validate() does not exist on spec\BitBag\SyliusQuadPa...rderAmountValidatorSpec. 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

51
        $this->/** @scrutinizer ignore-call */ 
52
               validate($payment, $orderAmountConstraint);
Loading history...
52
    }
53
}
54