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\Action; |
||||||
| 14 | |||||||
| 15 | use BitBag\SyliusQuadPayPlugin\Action\CaptureAction; |
||||||
| 16 | use BitBag\SyliusQuadPayPlugin\Client\QuadPayApiClientInterface; |
||||||
| 17 | use Payum\Core\Action\ActionInterface; |
||||||
| 18 | use Payum\Core\ApiAwareInterface; |
||||||
| 19 | use Payum\Core\Bridge\Spl\ArrayObject; |
||||||
| 20 | use Payum\Core\GatewayAwareInterface; |
||||||
| 21 | use Payum\Core\GatewayInterface; |
||||||
| 22 | use Payum\Core\Reply\HttpRedirect; |
||||||
| 23 | use Payum\Core\Request\Capture; |
||||||
| 24 | use Payum\Core\Security\TokenInterface; |
||||||
| 25 | use PhpSpec\ObjectBehavior; |
||||||
| 26 | use Sylius\Component\Core\Model\PaymentInterface; |
||||||
| 27 | |||||||
| 28 | final class CaptureActionSpec extends ObjectBehavior |
||||||
| 29 | { |
||||||
| 30 | function it_is_initializable(): void |
||||||
|
0 ignored issues
–
show
|
|||||||
| 31 | { |
||||||
| 32 | $this->shouldHaveType(CaptureAction::class); |
||||||
| 33 | } |
||||||
| 34 | |||||||
| 35 | function it_implements_action_interface(): void |
||||||
| 36 | { |
||||||
| 37 | $this->shouldHaveType(ActionInterface::class); |
||||||
| 38 | } |
||||||
| 39 | |||||||
| 40 | function it_implements_api_aware_interface(): void |
||||||
| 41 | { |
||||||
| 42 | $this->shouldHaveType(ApiAwareInterface::class); |
||||||
| 43 | } |
||||||
| 44 | |||||||
| 45 | function it_implements_gateway_aware_interface(): void |
||||||
| 46 | { |
||||||
| 47 | $this->shouldHaveType(GatewayAwareInterface::class); |
||||||
| 48 | } |
||||||
| 49 | |||||||
| 50 | function it_executes( |
||||||
| 51 | Capture $request, |
||||||
| 52 | ArrayObject $arrayObject, |
||||||
| 53 | PaymentInterface $payment, |
||||||
| 54 | TokenInterface $token, |
||||||
| 55 | GatewayInterface $gateway, |
||||||
| 56 | QuadPayApiClientInterface $quadPayApiClient |
||||||
| 57 | ): void { |
||||||
| 58 | $this->setGateway($gateway); |
||||||
|
0 ignored issues
–
show
The method
setGateway() does not exist on spec\BitBag\SyliusQuadPa...ction\CaptureActionSpec. 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...
|
|||||||
| 59 | $quadPayApiClient->createOrder([])->willReturn(['token' => 'test', 'redirectUrl' => 'test']); |
||||||
| 60 | $this->setApi($quadPayApiClient); |
||||||
|
0 ignored issues
–
show
The method
setApi() does not exist on spec\BitBag\SyliusQuadPa...ction\CaptureActionSpec. 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...
|
|||||||
| 61 | $token->getTargetUrl()->willReturn('url'); |
||||||
| 62 | $arrayObject->getArrayCopy()->willReturn([]); |
||||||
| 63 | $request->getModel()->willReturn($arrayObject); |
||||||
| 64 | $request->getFirstModel()->willReturn($payment); |
||||||
| 65 | $request->getToken()->willReturn($token); |
||||||
|
0 ignored issues
–
show
The method
willReturn() does not exist on Payum\Core\Security\TokenInterface.
(
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...
|
|||||||
| 66 | |||||||
| 67 | $arrayObject->offsetExists('orderToken')->shouldBeCalled(); |
||||||
| 68 | $arrayObject->offsetSet('merchant', ['redirectConfirmUrl' => 'url', 'redirectCancelUrl' => 'url?&status=abandoned'])->shouldBeCalled(); |
||||||
|
0 ignored issues
–
show
Are you sure the usage of
$arrayObject->offsetSet(...rl?&status=abandoned')) targeting Payum\Core\Bridge\Spl\ArrayObject::offsetSet() 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 The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. Loading history...
|
|||||||
| 69 | $arrayObject->offsetSet('orderToken', 'test')->shouldBeCalled(); |
||||||
|
0 ignored issues
–
show
Are you sure the usage of
$arrayObject->offsetSet('orderToken', 'test') targeting Payum\Core\Bridge\Spl\ArrayObject::offsetSet() 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 The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. Loading history...
|
|||||||
| 70 | $arrayObject->offsetSet('orderStatus', 'created')->shouldBeCalled(); |
||||||
|
0 ignored issues
–
show
Are you sure the usage of
$arrayObject->offsetSet('orderStatus', 'created') targeting Payum\Core\Bridge\Spl\ArrayObject::offsetSet() 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 The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. Loading history...
|
|||||||
| 71 | |||||||
| 72 | $this |
||||||
| 73 | ->shouldThrow(HttpRedirect::class) |
||||||
| 74 | ->during('execute', [$request]) |
||||||
| 75 | ; |
||||||
| 76 | } |
||||||
| 77 | |||||||
| 78 | function it_supports_only_capture_request_and_array_access( |
||||||
| 79 | Capture $request, |
||||||
| 80 | \ArrayAccess $arrayAccess |
||||||
| 81 | ): void { |
||||||
| 82 | $request->getModel()->willReturn($arrayAccess); |
||||||
| 83 | |||||||
| 84 | $this->supports($request)->shouldReturn(true); |
||||||
|
0 ignored issues
–
show
The method
supports() does not exist on spec\BitBag\SyliusQuadPa...ction\CaptureActionSpec. 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...
|
|||||||
| 85 | } |
||||||
| 86 | } |
||||||
| 87 |
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.