Skip to content

Commit

Permalink
[CatalogPromotion][Behat] Improve steps names
Browse files Browse the repository at this point in the history
  • Loading branch information
GSadee committed Sep 8, 2021
1 parent 44c8307 commit b2c465e
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Feature: Applying catalog promotions for variants
And this product has "PHP Mug" variant priced at "$5.00"
And this product has "Kotlin Mug" variant priced at "$7.00"
And there is a catalog promotion with "winter_sale" code and "Winter sale" name
And it will be applied on "PHP T-Shirt" variant
And it will reduce price by "30%"
And it applies on "PHP T-Shirt" variant
And it reduces price by "30%"

@api
Scenario: Applying simple catalog promotions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Feature: Seeing applied catalog promotions on variant
And the store has a "T-Shirt" configurable product
And this product has "PHP T-Shirt" variant priced at "$20.00"
And there is a catalog promotion with "winter_sale" code and "Winter sale" name
And it will be applied on "PHP T-Shirt" variant
And it will reduce price by "50%"
And it applies on "PHP T-Shirt" variant
And it reduces price by "50%"

@api
Scenario: Seeing applied catalog promotion on variant
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Feature: Seeing applied catalog promotions on variants list
And this product has "Kotlin T-Shirt" variant priced at "$40.00"
And this product has "Python T-Shirt" variant priced at "$40.00"
And there is a catalog promotion with "winter_sale" code and "Winter sale" name
And it will be applied on "PHP T-Shirt" variant
And it will reduce price by "50%"
And it applies on "PHP T-Shirt" variant
And it reduces price by "50%"

@api
Scenario: Seeing applied catalog promotion on variant
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ Feature: Creating a catalog promotion
And I name it "Winter sale"
And I specify its label as "Winter -50%" in "English (United States)"
And I describe it as "This promotion gives a 50% discount on all products" in "English (United States)"
And it applies on variants "PHP T-Shirt" variant and "Kotlin T-Shirt" variant
And it gives the "50%" percentage discount
And I add rule that applies on variants "PHP T-Shirt" variant and "Kotlin T-Shirt" variant
And I add action that gives the "50%" percentage discount
And I add it
Then there should be 1 new catalog promotion on the list
And it should have "winter_sale" code and "Winter sale" name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Feature: Editing catalog promotion
And this product has "PHP T-Shirt" variant priced at "$20.00"
And this product has "Kotlin T-Shirt" variant priced at "$40.00"
And there is a catalog promotion with "christmas_sale" code and "Christmas sale" name
And it will be applied on "PHP T-Shirt" variant
And it will reduce price by "30%"
And it applies on "PHP T-Shirt" variant
And it reduces price by "30%"
And I am logged in as an administrator

@api @ui
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ public function iWantToModifyACatalogPromotion(CatalogPromotionInterface $catalo
}

/**
* @When /^it gives the ("[^"]+") percentage discount$/
* @When /^I add action that gives the ("[^"]+") percentage discount$/
*/
public function iGivesPercentageDistount(float $amount): void
public function iAddActionThatGivesThePercentageDiscount(float $amount): void
{
$actions = [[
'type' => CatalogPromotionActionInterface::TYPE_PERCENTAGE_DISCOUNT,
Expand Down Expand Up @@ -194,9 +194,9 @@ public function iBrowseCatalogPromotions(): void
}

/**
* @When /^it applies on variants ("[^"]+" variant) and ("[^"]+" variant)$/
* @When /^I add rule that applies on variants ("[^"]+" variant) and ("[^"]+" variant)$/
*/
public function iAddTheRuleConfiguredWithProductAnd(ProductVariantInterface $firstVariant, ProductVariantInterface $secondVariant): void
public function iAddRuleThatAppliesOnVariants(ProductVariantInterface $firstVariant, ProductVariantInterface $secondVariant): void
{
$rules = [[
'type' => CatalogPromotionRuleInterface::TYPE_FOR_VARIANTS,
Expand Down Expand Up @@ -263,9 +263,9 @@ public function ISpecifyNonexistentCatalogPromotionRule(): void
}

/**
* @When I specify rule "For variants" with the wrong configuration
* @When I add for variants rule with the wrong configuration
*/
public function iSpecifyRuleWithWrongConfiguration(): void
public function iAddForVariantsRuleWithTheWrongConfiguration(): void
{
$rules = [[
'type' => CatalogPromotionRuleInterface::TYPE_FOR_VARIANTS,
Expand Down
6 changes: 3 additions & 3 deletions src/Sylius/Behat/Context/Setup/CatalogPromotionContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ public function theCatalogPromotionIsAvailableIn(
}

/**
* @Given /^(it) will be applied on ("[^"]+" variant)$/
* @Given /^(it) applies on ("[^"]+" variant)$/
*/
public function itWillBeAppliedOnVariant(CatalogPromotionInterface $catalogPromotion, ProductVariantInterface $variant): void
public function itAppliesOnVariant(CatalogPromotionInterface $catalogPromotion, ProductVariantInterface $variant): void
{
/** @var CatalogPromotionRuleInterface $catalogPromotionRule */
$catalogPromotionRule = $this->catalogPromotionRuleFactory->createNew();
Expand All @@ -100,7 +100,7 @@ public function itWillBeAppliedOnVariant(CatalogPromotionInterface $catalogPromo
}

/**
* @Given /^(it) will reduce price by ("[^"]+")$/
* @Given /^(it) reduces price by ("[^"]+")$/
*/
public function itWillReducePrice(CatalogPromotionInterface $catalogPromotion, float $discount): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ public function iMakeItUnavailableInChannel(string $channelName): void
}

/**
* @When /^it applies on variants ("[^"]+" variant) and ("[^"]+" variant)$/
* @When /^I add rule that applies on variants ("[^"]+" variant) and ("[^"]+" variant)$/
*/
public function itAppliesOnVariants(ProductVariantInterface ...$variants): void
public function iAddRuleThatAppliesOnVariants(ProductVariantInterface ...$variants): void
{
$variantCodes = array_map(function(ProductVariantInterface $variant) {
return $variant->getCode();
Expand All @@ -149,9 +149,9 @@ public function itAppliesOnVariants(ProductVariantInterface ...$variants): void
}

/**
* @When /^it gives the "([^"]+)%" percentage discount$/
* @When I add action that gives the ":discount%" percentage discount
*/
public function catalogPromotionGivesDiscount(string $discount): void
public function iAddActionThatGivesThePercentageDiscount(string $discount): void
{
$this->formElement->addAction();
$this->formElement->specifyLastActionDiscount($discount);
Expand Down

0 comments on commit b2c465e

Please sign in to comment.