Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[API] Adding inexistent payment method #12657

Merged
merged 3 commits into from May 24, 2021

Conversation

arti0090
Copy link
Contributor

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
License MIT

@arti0090 arti0090 requested a review from a team as a code owner May 20, 2021 10:45
@probot-autolabeler probot-autolabeler bot added the API APIs related issues and PRs. label May 20, 2021
src/Sylius/Behat/Context/Api/Shop/CheckoutContext.php Outdated Show resolved Hide resolved

function it_throws_an_exception_if_constraint_does_not_type_of_choose_payment_method_eligibility(): void
{
$constraint = new class() extends Constraint implements PaymentMethodCodeAwareInterface {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can simplify this spec to sth like:

function it_throws_an_exception_if_constraint_is_not_an_instance_of_chosen_shipping_method_eligibility(): void
{
    $this
        ->shouldThrow(\InvalidArgumentException::class)
        ->during('validate', [new ChoosePaymentMethod('code'), new class() extends Constraint {}])
    ;
}

/**
* @When I try to select :paymentMethodCode payment method
*/
public function iTryToSelectPaymentMethod(string $paymentMethodCode): void
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is a duplication of method iChoosePaymentMethod can you use it instead of making a new one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not in 100%, the call is same (endpoint) but content is differently created see: $request->setContent(['paymentMethod' => $this->iriConverter->getItemIriFromResourceClass(PaymentMethod::class, ['code' => $paymentMethodCode])]);

@lchrusciel lchrusciel merged commit d1d4502 into Sylius:master May 24, 2021
@lchrusciel
Copy link
Member

Thanks, @arti0090! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API APIs related issues and PRs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants