mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
[PromotionCoupon] Enable todo api scenario for filtering by code
This commit is contained in:
parent
7958895598
commit
c14937cff9
2 changed files with 36 additions and 3 deletions
|
|
@ -19,7 +19,7 @@ Feature: Filtering coupons
|
|||
And this coupon expires on "20-02-2023"
|
||||
And I am logged in as an administrator
|
||||
|
||||
@ui @todo-api
|
||||
@api @ui
|
||||
Scenario: Filtering coupons by code
|
||||
Given I am browsing coupons of this promotion
|
||||
When I filter by code containing "X"
|
||||
|
|
|
|||
|
|
@ -49,8 +49,21 @@ final class ManagingPromotionCouponsContext implements Context
|
|||
{
|
||||
$this->client->index(Resources::PROMOTION_COUPONS);
|
||||
$this->client->addFilter(
|
||||
'promotion',
|
||||
$this->iriConverter->getIriFromResourceInSection($promotion, 'admin'),
|
||||
'promotion.code',
|
||||
$promotion->getCode(),
|
||||
);
|
||||
$this->client->filter();
|
||||
}
|
||||
|
||||
/**
|
||||
* @When I filter by code containing :phrase
|
||||
*/
|
||||
public function iFilterByCodeContaining(string $phrase): void
|
||||
{
|
||||
$this->client->index(Resources::PROMOTION_COUPONS);
|
||||
$this->client->addFilter(
|
||||
'code',
|
||||
$phrase,
|
||||
);
|
||||
$this->client->filter();
|
||||
}
|
||||
|
|
@ -632,6 +645,26 @@ final class ManagingPromotionCouponsContext implements Context
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should see a single promotion coupon in the list
|
||||
*/
|
||||
public function iShouldSeeASinglePromotionCouponInTheList(): void
|
||||
{
|
||||
Assert::same($this->responseChecker->countCollectionItems($this->client->getLastResponse()), 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should see the promotion coupon :coupon in the list
|
||||
*/
|
||||
public function iShouldSeeThePromotionCouponInTheList(PromotionCouponInterface $coupon): void
|
||||
{
|
||||
Assert::true($this->responseChecker->hasItemWithValue(
|
||||
$this->client->getLastResponse(),
|
||||
'code',
|
||||
$coupon->getCode(),
|
||||
));
|
||||
}
|
||||
|
||||
private function sortBy(string $order, string $field): void
|
||||
{
|
||||
$this->client->sort([$field => str_starts_with($order, 'de') ? 'desc' : 'asc']);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue