BitBagCommerce /
SyliusMolliePlugin
| 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\StateMachine; |
||||||
| 14 | |||||||
| 15 | use BitBag\SyliusMolliePlugin\Action\Api\BaseApiAwareAction; |
||||||
| 16 | use BitBag\SyliusMolliePlugin\Action\StateMachine\StatusRecurringSubscriptionAction; |
||||||
| 17 | use BitBag\SyliusMolliePlugin\Client\MollieApiClient; |
||||||
| 18 | use BitBag\SyliusMolliePlugin\Entity\SubscriptionInterface; |
||||||
| 19 | use BitBag\SyliusMolliePlugin\Request\StateMachine\StatusRecurringSubscription; |
||||||
| 20 | use BitBag\SyliusMolliePlugin\Transitions\SubscriptionTransitions; |
||||||
| 21 | use Doctrine\ORM\EntityManagerInterface; |
||||||
| 22 | use Mollie\Api\Endpoints\CustomerEndpoint; |
||||||
| 23 | use Mollie\Api\Resources\Customer; |
||||||
| 24 | use Mollie\Api\Resources\Subscription; |
||||||
| 25 | use Mollie\Api\Types\SubscriptionStatus; |
||||||
| 26 | use Payum\Core\Action\ActionInterface; |
||||||
| 27 | use Payum\Core\ApiAwareInterface; |
||||||
| 28 | use PhpSpec\ObjectBehavior; |
||||||
| 29 | use SM\Factory\FactoryInterface; |
||||||
| 30 | use SM\StateMachine\StateMachineInterface; |
||||||
| 31 | |||||||
| 32 | final class StatusRecurringSubscriptionActionSpec extends ObjectBehavior |
||||||
| 33 | { |
||||||
| 34 | function let( |
||||||
|
0 ignored issues
–
show
|
|||||||
| 35 | EntityManagerInterface $subscriptionManager, |
||||||
| 36 | FactoryInterface $subscriptionSateMachineFactory |
||||||
| 37 | ): void { |
||||||
| 38 | $this->beConstructedWith( |
||||||
| 39 | $subscriptionManager, |
||||||
| 40 | $subscriptionSateMachineFactory |
||||||
| 41 | ); |
||||||
| 42 | } |
||||||
| 43 | |||||||
| 44 | function it_is_initializable(): void |
||||||
|
0 ignored issues
–
show
|
|||||||
| 45 | { |
||||||
| 46 | $this->shouldHaveType(StatusRecurringSubscriptionAction::class); |
||||||
| 47 | } |
||||||
| 48 | |||||||
| 49 | function it_implements_action_interface(): void |
||||||
| 50 | { |
||||||
| 51 | $this->shouldHaveType(ActionInterface::class); |
||||||
| 52 | } |
||||||
| 53 | |||||||
| 54 | function it_implements_api_aware_interface(): void |
||||||
| 55 | { |
||||||
| 56 | $this->shouldHaveType(ApiAwareInterface::class); |
||||||
| 57 | } |
||||||
| 58 | |||||||
| 59 | function it_extends_base_api_aware(): void |
||||||
| 60 | { |
||||||
| 61 | $this->shouldHaveType(BaseApiAwareAction::class); |
||||||
| 62 | } |
||||||
| 63 | |||||||
| 64 | function it_executes( |
||||||
| 65 | StatusRecurringSubscription $request, |
||||||
| 66 | MollieApiClient $mollieApiClient, |
||||||
| 67 | SubscriptionInterface $subscription, |
||||||
| 68 | CustomerEndpoint $customerEndpoint, |
||||||
| 69 | Customer $customer, |
||||||
| 70 | FactoryInterface $subscriptionSateMachineFactory, |
||||||
| 71 | StateMachineInterface $stateMachine, |
||||||
| 72 | Subscription $subscriptionApi |
||||||
| 73 | ): void { |
||||||
| 74 | $this->setApi($mollieApiClient); |
||||||
|
0 ignored issues
–
show
The method
setApi() does not exist on spec\BitBag\SyliusMollie...gSubscriptionActionSpec. 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...
|
|||||||
| 75 | $stateMachine->can(SubscriptionTransitions::TRANSITION_ACTIVATE)->willReturn(); |
||||||
| 76 | $subscriptionApi->status = SubscriptionStatus::STATUS_ACTIVE; |
||||||
| 77 | $subscriptionSateMachineFactory->get($subscription, SubscriptionTransitions::GRAPH)->willReturn($stateMachine); |
||||||
|
0 ignored issues
–
show
The method
willReturn() does not exist on SM\StateMachine\StateMachineInterface.
(
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...
|
|||||||
| 78 | $subscription->getSubscriptionId()->willReturn('id_1'); |
||||||
| 79 | $subscription->getCustomerId()->willReturn('id_1'); |
||||||
| 80 | $customer->getSubscription('id_1')->willReturn($subscriptionApi); |
||||||
|
0 ignored issues
–
show
The method
willReturn() does not exist on Mollie\Api\Resources\Subscription.
(
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...
|
|||||||
| 81 | $customerEndpoint->get('id_1')->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. Loading history...
|
|||||||
| 82 | $mollieApiClient->customers = $customerEndpoint; |
||||||
| 83 | $request->getModel()->willReturn($subscription); |
||||||
| 84 | |||||||
| 85 | $this->execute($request); |
||||||
|
0 ignored issues
–
show
The method
execute() does not exist on spec\BitBag\SyliusMollie...gSubscriptionActionSpec. 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...
|
|||||||
| 86 | } |
||||||
| 87 | |||||||
| 88 | function it_supports_status_recurring_subscription_request_and_subscription_model( |
||||||
| 89 | StatusRecurringSubscription $request, |
||||||
| 90 | SubscriptionInterface $subscription |
||||||
| 91 | ): void { |
||||||
| 92 | $request->getModel()->willReturn($subscription); |
||||||
| 93 | |||||||
| 94 | $this->supports($request)->shouldReturn(true); |
||||||
|
0 ignored issues
–
show
The method
supports() does not exist on spec\BitBag\SyliusMollie...gSubscriptionActionSpec. 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...
|
|||||||
| 95 | } |
||||||
| 96 | } |
||||||
| 97 |
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.