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 |
|
|
|
|
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); |
|
|
|
|
54
|
|
|
$this->setGateway($gateway); |
|
|
|
|
55
|
|
|
$payment->getDetails()->willReturn([]); |
56
|
|
|
$request->getModel()->willReturn($payment); |
57
|
|
|
|
58
|
|
|
$request->markNew()->shouldBeCalled(); |
|
|
|
|
59
|
|
|
|
60
|
|
|
$this->execute($request); |
|
|
|
|
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); |
|
|
|
|
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
|
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.