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\Api; |
||||||
14 | |||||||
15 | use BitBag\SyliusMolliePlugin\Action\Api\BaseApiAwareAction; |
||||||
16 | use BitBag\SyliusMolliePlugin\Action\Api\CreateCustomerAction; |
||||||
17 | use BitBag\SyliusMolliePlugin\Client\MollieApiClient; |
||||||
18 | use BitBag\SyliusMolliePlugin\Request\Api\CreateCustomer; |
||||||
19 | use Mollie\Api\Endpoints\CustomerEndpoint; |
||||||
20 | use Mollie\Api\Resources\Customer; |
||||||
21 | use Payum\Core\Action\ActionInterface; |
||||||
22 | use Payum\Core\ApiAwareInterface; |
||||||
23 | use Payum\Core\Bridge\Spl\ArrayObject; |
||||||
24 | use PhpSpec\ObjectBehavior; |
||||||
25 | |||||||
26 | final class CreateCustomerActionSpec extends ObjectBehavior |
||||||
27 | { |
||||||
28 | function it_is_initializable(): void |
||||||
0 ignored issues
–
show
|
|||||||
29 | { |
||||||
30 | $this->shouldHaveType(CreateCustomerAction::class); |
||||||
31 | } |
||||||
32 | |||||||
33 | function it_implements_action_interface(): void |
||||||
34 | { |
||||||
35 | $this->shouldHaveType(ActionInterface::class); |
||||||
36 | } |
||||||
37 | |||||||
38 | function it_implements_api_aware_interface(): void |
||||||
39 | { |
||||||
40 | $this->shouldHaveType(ApiAwareInterface::class); |
||||||
41 | } |
||||||
42 | |||||||
43 | function it_extends_base_api_aware(): void |
||||||
44 | { |
||||||
45 | $this->shouldHaveType(BaseApiAwareAction::class); |
||||||
46 | } |
||||||
47 | |||||||
48 | function it_executes( |
||||||
49 | CreateCustomer $request, |
||||||
50 | MollieApiClient $mollieApiClient, |
||||||
51 | CustomerEndpoint $customerEndpoint, |
||||||
52 | Customer $customer, |
||||||
53 | ArrayObject $arrayObject |
||||||
54 | ): void { |
||||||
55 | $mollieApiClient->customers = $customerEndpoint; |
||||||
56 | $this->setApi($mollieApiClient); |
||||||
0 ignored issues
–
show
The method
setApi() does not exist on spec\BitBag\SyliusMollie...reateCustomerActionSpec . 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
![]() |
|||||||
57 | $customer->id = 'id_1'; |
||||||
58 | $arrayObject->offsetGet('fullName')->willReturn('Jan Kowalski'); |
||||||
59 | $arrayObject->offsetGet('email')->willReturn('[email protected]'); |
||||||
60 | $request->getModel()->willReturn($arrayObject); |
||||||
61 | $customerEndpoint->create(['name' => 'Jan Kowalski', 'email' => '[email protected]'])->willReturn($customer); |
||||||
0 ignored issues
–
show
The method
willReturn() does not exist on Mollie\Api\Resources\Customer .
(
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. ![]() |
|||||||
62 | |||||||
63 | $arrayObject->offsetSet('customer_mollie_id', 'id_1')->shouldBeCalled(); |
||||||
0 ignored issues
–
show
Are you sure the usage of
$arrayObject->offsetSet(...mer_mollie_id', 'id_1') 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. ![]() |
|||||||
64 | |||||||
65 | $this->execute($request); |
||||||
0 ignored issues
–
show
The method
execute() does not exist on spec\BitBag\SyliusMollie...reateCustomerActionSpec . 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
![]() |
|||||||
66 | } |
||||||
67 | |||||||
68 | function it_supports_only_create_customer_request_and_array_access( |
||||||
69 | CreateCustomer $request, |
||||||
70 | \ArrayAccess $arrayAccess |
||||||
71 | ): void { |
||||||
72 | $request->getModel()->willReturn($arrayAccess); |
||||||
73 | |||||||
74 | $this->supports($request)->shouldReturn(true); |
||||||
0 ignored issues
–
show
The method
supports() does not exist on spec\BitBag\SyliusMollie...reateCustomerActionSpec . 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
![]() |
|||||||
75 | } |
||||||
76 | } |
||||||
77 |
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.