BitBagCommerce /
SyliusQuadPayPlugin
| 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\Twig\Extension; |
||||||
| 14 | |||||||
| 15 | use BitBag\SyliusQuadPayPlugin\QuadPayGatewayFactory; |
||||||
| 16 | use BitBag\SyliusQuadPayPlugin\Repository\PaymentMethodRepositoryInterface; |
||||||
| 17 | use BitBag\SyliusQuadPayPlugin\Twig\Extension\RenderWidgetExtension; |
||||||
| 18 | use Payum\Core\Model\GatewayConfigInterface; |
||||||
| 19 | use PhpSpec\ObjectBehavior; |
||||||
| 20 | use Sylius\Component\Core\Model\ChannelInterface; |
||||||
| 21 | use Sylius\Component\Core\Model\PaymentMethodInterface; |
||||||
| 22 | use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface; |
||||||
| 23 | |||||||
| 24 | final class RenderWidgetExtensionSpec extends ObjectBehavior |
||||||
| 25 | { |
||||||
| 26 | function let( |
||||||
|
0 ignored issues
–
show
|
|||||||
| 27 | PaymentMethodRepositoryInterface $paymentMethodRepository, |
||||||
| 28 | EngineInterface $templatingEngine |
||||||
| 29 | ): void { |
||||||
| 30 | $this->beConstructedWith($paymentMethodRepository, $templatingEngine); |
||||||
| 31 | } |
||||||
| 32 | |||||||
| 33 | function it_is_initializable(): void |
||||||
|
0 ignored issues
–
show
|
|||||||
| 34 | { |
||||||
| 35 | $this->shouldHaveType(RenderWidgetExtension::class); |
||||||
| 36 | } |
||||||
| 37 | |||||||
| 38 | function it_extends_twig_extension(): void |
||||||
| 39 | { |
||||||
| 40 | $this->shouldHaveType(\Twig_Extension::class); |
||||||
| 41 | } |
||||||
| 42 | |||||||
| 43 | function it_returns_functions(): void |
||||||
| 44 | { |
||||||
| 45 | $functions = $this->getFunctions(); |
||||||
|
0 ignored issues
–
show
The method
getFunctions() does not exist on spec\BitBag\SyliusQuadPa...nderWidgetExtensionSpec. 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
Loading history...
|
|||||||
| 46 | |||||||
| 47 | $functions->shouldHaveCount(1); |
||||||
| 48 | |||||||
| 49 | /** @var \Twig_SimpleFunction $function */ |
||||||
| 50 | $function = $functions[0]; |
||||||
| 51 | |||||||
| 52 | $function->shouldHaveType(\Twig_SimpleFunction::class); |
||||||
|
0 ignored issues
–
show
The method
shouldHaveType() does not exist on Twig_SimpleFunction.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
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...
|
|||||||
| 53 | |||||||
| 54 | $function->getName()->shouldReturn('bitbag_quadpay_render_widget'); |
||||||
| 55 | } |
||||||
| 56 | |||||||
| 57 | function it_renders_quadpay_widget( |
||||||
| 58 | ChannelInterface $channel, |
||||||
| 59 | EngineInterface $templatingEngine, |
||||||
| 60 | PaymentMethodRepositoryInterface $paymentMethodRepository, |
||||||
| 61 | PaymentMethodInterface $paymentMethod, |
||||||
| 62 | GatewayConfigInterface $gatewayConfig |
||||||
| 63 | ): void { |
||||||
| 64 | $gatewayConfig->getConfig()->willReturn([ |
||||||
| 65 | 'minimumAmount' => 300, |
||||||
| 66 | 'maximumAmount' => 3000, |
||||||
| 67 | ]); |
||||||
| 68 | $paymentMethod->getGatewayConfig()->willReturn($gatewayConfig); |
||||||
|
0 ignored issues
–
show
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
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 | $paymentMethodRepository->findOneByGatewayFactoryNameAndChannel(QuadPayGatewayFactory::FACTORY_NAME, $channel)->willReturn($paymentMethod); |
||||||
|
0 ignored issues
–
show
The method
willReturn() does not exist on Sylius\Component\Core\Model\PaymentMethodInterface.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
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...
|
|||||||
| 70 | $templatingEngine->render('@BitBagSyliusQuadPayPlugin/_widget.html.twig', [ |
||||||
| 71 | 'amount' => 100, |
||||||
| 72 | 'paymentMethod' => $paymentMethod, |
||||||
| 73 | 'minAmount' => 300, |
||||||
| 74 | 'maxAmount' => 3000, |
||||||
| 75 | ])->willReturn('<div>BitBag</div>'); |
||||||
| 76 | |||||||
| 77 | $this->renderQuadPayWidget(100, $channel)->shouldReturn('<div>BitBag</div>'); |
||||||
|
0 ignored issues
–
show
The method
renderQuadPayWidget() does not exist on spec\BitBag\SyliusQuadPa...nderWidgetExtensionSpec. 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
Loading history...
|
|||||||
| 78 | } |
||||||
| 79 | } |
||||||
| 80 |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.