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

Cover 'order filtration' scenarios in API #15566

Merged
merged 3 commits into from Nov 30, 2023
Merged

Conversation

TheMilek
Copy link
Member

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

@TheMilek TheMilek requested a review from a team as a code owner November 28, 2023 07:59
@probot-autolabeler probot-autolabeler bot added the API APIs related issues and PRs. label Nov 28, 2023
@TheMilek TheMilek added the Admin AdminBundle related issues and PRs. label Nov 28, 2023
Copy link

github-actions bot commented Nov 28, 2023

Bunnyshell Preview Environment deleted

Available commands:

  • /bns:deploy to redeploy the environment

@@ -17,15 +17,15 @@ Feature: Filtering orders by products
And the customer chose "Free" shipping method to "United States" with "Offline" payment
And I am logged in as an administrator

@ui @javascript
@ui @api @javascript
Copy link
Member

Choose a reason for hiding this comment

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

Can we establish a convention? In the system, we have three variations: @api @ui @javascript, @ui @api @javascript, and @ui @javascript @api. I know it's not a problem of this PR.

Comment on lines +135 to +140
if (str_contains($total, '.')) {
$total = str_replace('.', '', $total);
$this->client->addFilter('total[gt]', $total);

return;
}
Copy link
Member

Choose a reason for hiding this comment

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

I suggest creating a private method that either removes . or adds 00. This method could be used here and method below.

<tag name="api_platform.filter" />
</service>

<service id="sylius.api.order_product_filter" parent="api_platform.doctrine.orm.search_filter" public="true">
Copy link
Member

Choose a reason for hiding this comment

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

It is only a suggestion to connect all search_filter for order in one filter.


/**
* @When I filter by product :productName
* @When I filter by products :firstProduct and :secondProduct
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* @When I filter by products :firstProduct and :secondProduct
* @When I filter by products :firstProductName and :secondProductName

* @When I filter by product :productName
* @When I filter by products :firstProduct and :secondProduct
*/
public function iFilterByProduct(string ...$productNames): void
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
public function iFilterByProduct(string ...$productNames): void
public function iFilterByProduct(string ...$productsNames): void


/**
* @When I filter by variant :variantName
* @When I filter by variants :firstVariant and :secondVariant
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* @When I filter by variants :firstVariant and :secondVariant
* @When I filter by variants :firstVariantName and :secondVariantName

/**
* @Then I should not see an order with :orderNumber number
*/
public function iShouldNotSeeOrderWithNumber(string $orderNumber)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
public function iShouldNotSeeOrderWithNumber(string $orderNumber)
public function iShouldNotSeeOrderWithNumber(string $orderNumber): void

@GSadee GSadee merged commit b450f1d into Sylius:1.13 Nov 30, 2023
25 checks passed
@GSadee
Copy link
Member

GSadee commented Nov 30, 2023

Thanks, Kamil! 🎉

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

Successfully merging this pull request may close these issues.

None yet

3 participants