Skip to content

Commit

Permalink
PR review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Zales0123 committed Jul 2, 2019
1 parent 21bd8ac commit 1a5dcd2
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 71 deletions.
Expand Up @@ -11,34 +11,34 @@ Feature: Coupon generate instruction validation
And I am logged in as an administrator

@ui
Scenario: Trying to generate a new coupons without specifying its amount
Given I want to generate a new coupons for this promotion
When I do not specify its amount
And I specify its code length as 6
Scenario: Trying to generate new coupons without specifying their amount
When I want to generate new coupons for this promotion
And I do not specify its amount
And I specify their code length as 6
And I limit generated coupons usage to 25 times
And I make generated coupons valid until "26.03.2017"
And I try to generate it
And I try to generate these coupons
Then I should be notified that generate amount is required
And there should be 0 coupon related to this promotion

@ui
Scenario: Trying to generate a new coupons without specifying its code length
Given I want to generate a new coupons for this promotion
When I do not specify its code length
And I specify its amount as 4
Scenario: Trying to generate a new coupons without specifying their code length
When I want to generate new coupons for this promotion
And I do not specify their code length
And I choose the amount of 4 coupons to be generated
And I limit generated coupons usage to 25 times
And I make generated coupons valid until "26.03.2017"
And I try to generate it
And I try to generate these coupons
Then I should be notified that generate code length is required
And there should be 0 coupon related to this promotion

@ui
Scenario: Trying to generate a new coupons with amount and code length impossible to generate
Given I want to generate a new coupons for this promotion
When I specify its code length as 1
And I specify its amount as 20
Scenario: Trying to generate new coupons with amount and code length impossible to generate
When I want to generate new coupons for this promotion
And I specify their code length as 1
And I choose the amount of 20 coupons to be generated
And I limit generated coupons usage to 25 times
And I make generated coupons valid until "26.03.2017"
And I try to generate it
And I try to generate these coupons
Then I should be notified that generating 20 coupons with code length equal to 1 is not possible
And there should be 0 coupon related to this promotion
28 changes: 14 additions & 14 deletions features/promotion/managing_coupons/generating_coupon.feature
@@ -1,5 +1,5 @@
@managing_promotion_coupons
Feature: Generating a new coupons
Feature: Generating new coupons
In order to quickly create specific number of coupons for my promotions
As an Administrator
I want to be able to generate coupons for promotion
Expand All @@ -12,21 +12,21 @@ Feature: Generating a new coupons

@ui
Scenario: Generating a new coupons
Given I want to generate a new coupons for this promotion
When I specify its amount as 5
And I specify its code length as 6
When I want to generate new coupons for this promotion
And I choose the amount of 5 coupons to be generated
And I specify their code length as 6
And I limit generated coupons usage to 25 times
And I make generated coupons valid until "26.03.2017"
And I generate it
Then I should be notified that it has been successfully generated
And there should be 5 coupon related to this promotion
And I generate these coupons
Then I should be notified that they have been successfully generated
And there should be 5 coupons related to this promotion

@ui
Scenario: Generating a new coupons without expiration date
Given I want to generate a new coupons for this promotion
When I specify its amount as 5
And I specify its code length as 6
Scenario: Generating new coupons without expiration date
When I want to generate new coupons for this promotion
And I choose the amount of 5 coupons to be generated
And I specify their code length as 6
And I limit generated coupons usage to 25 times
And I generate it
Then I should be notified that it has been successfully generated
And there should be 5 coupon related to this promotion
And I generate these coupons
Then I should be notified that they have been successfully generated
And there should be 5 coupons related to this promotion
@@ -1,8 +1,8 @@
@managing_promotion_coupons
Feature: Generating a new coupons with prefix and suffi
Feature: Generating new coupons with prefix and suffix
In order to quickly create specific number of tailored coupons for my promotions
As an Administrator
I want to be able to generate coupons for promotion with prefix and suffix
I want to be able to generate promotion coupons with prefix and suffix

Background:
Given the store operates on a single channel in "United States"
Expand All @@ -12,35 +12,35 @@ Feature: Generating a new coupons with prefix and suffi

@ui
Scenario: Generating new coupons with prefix
Given I want to generate a new coupons for this promotion
When I specify its amount as 5
And I specify its prefix as "CHRISTMAS_"
And I specify its code length as 6
And I generate it
Then I should be notified that it has been successfully generated
And there should be 5 coupon related to this promotion
And all of the coupons codes should be prefixed with "CHRISTMAS_"
Given I want to generate new coupons for this promotion
When I choose the amount of 5 coupons to be generated
And I specify their prefix as "CHRISTMAS_"
And I specify their code length as 6
And I generate these coupons
Then I should be notified that they have been successfully generated
And there should be 5 coupons related to this promotion
And all of the coupon codes should be prefixed with "CHRISTMAS_"

@ui
Scenario: Generating new coupons with suffix
Given I want to generate a new coupons for this promotion
When I specify its amount as 5
And I specify its suffix as "_CHRISTMAS"
And I specify its code length as 6
And I generate it
Then I should be notified that it has been successfully generated
And there should be 5 coupon related to this promotion
And all of the coupons codes should be suffixed with "_CHRISTMAS"
Given I want to generate new coupons for this promotion
When I choose the amount of 5 coupons to be generated
And I specify their suffix as "_CHRISTMAS"
And I specify their code length as 6
And I generate these coupons
Then I should be notified that they have been successfully generated
And there should be 5 coupons related to this promotion
And all of the coupon codes should be suffixed with "_CHRISTMAS"

@ui
Scenario: Generating new coupons with prefix and suffix
Given I want to generate a new coupons for this promotion
When I specify its amount as 5
And I specify its prefix as "CHRISTMAS_"
And I specify its suffix as "_SALE"
And I specify its code length as 6
And I generate it
Then I should be notified that it has been successfully generated
And there should be 5 coupon related to this promotion
And all of the coupons codes should be prefixed with "CHRISTMAS_"
And all of the coupons codes should be suffixed with "_SALE"
Given I want to generate new coupons for this promotion
When I choose the amount of 5 coupons to be generated
And I specify their prefix as "CHRISTMAS_"
And I specify their suffix as "_SALE"
And I specify their code length as 6
And I generate these coupons
Then I should be notified that they have been successfully generated
And there should be 5 coupons related to this promotion
And all of the coupon codes should be prefixed with "CHRISTMAS_"
And all of the coupon codes should be suffixed with "_SALE"
Expand Up @@ -88,32 +88,32 @@ public function iWantToModifyTheCoupon(PromotionCouponInterface $coupon, Promoti
}

/**
* @Given /^I want to generate a new coupons for (this promotion)$/
* @When /^I want to generate new coupons for (this promotion)$/
*/
public function iWantToGenerateANewCouponsForThisPromotion(PromotionInterface $promotion)
public function iWantToGenerateNewCouponsForThisPromotion(PromotionInterface $promotion)
{
$this->generatePage->open(['promotionId' => $promotion->getId()]);
}

/**
* @When /^I specify its code length as (\d+)$/
* @When I do not specify its code length
* @When /^I specify their code length as (\d+)$/
* @When I do not specify their code length
*/
public function iSpecifyItsCodeLengthAs($codeLength = null)
public function iSpecifyTheirCodeLengthAs($codeLength = null)
{
$this->generatePage->specifyCodeLength($codeLength ?? '');
}

/**
* @When I specify its prefix as :prefix
* @When I specify their prefix as :prefix
*/
public function specifyPrefixAs(string $prefix): void
{
$this->generatePage->specifyPrefix($prefix);
}

/**
* @When I specify its suffix as :prefix
* @When I specify their suffix as :suffix
*/
public function specifySuffixAs(string $suffix): void
{
Expand Down Expand Up @@ -164,6 +164,7 @@ public function iChangeItsUsageLimitTo($limit)
/**
* @When I specify its amount as :amount
* @When I do not specify its amount
* @When I choose the amount of :amount coupons to be generated
*/
public function iSpecifyItsAmountAs($amount = null)
{
Expand Down Expand Up @@ -221,7 +222,9 @@ public function iSaveMyChanges()

/**
* @When I generate it
* @When I generate these coupons
* @When I try to generate it
* @When I try to generate these coupons
*/
public function iGenerateIt()
{
Expand Down Expand Up @@ -255,7 +258,8 @@ public function iDeleteThem(): void
}

/**
* @Then /^there should be (\d+) coupon related to (this promotion)$/
* @Then /^there should be (0|1) coupon related to (this promotion)$/
* @Then /^there should be (\b(?![01]\b)\d{1,9}\b) coupons related to (this promotion)$/
*/
public function thereShouldBeCouponRelatedTo($number, PromotionInterface $promotion)
{
Expand All @@ -265,19 +269,19 @@ public function thereShouldBeCouponRelatedTo($number, PromotionInterface $promot
}

/**
* @Then all of the coupons codes should be prefixed with :prefix
* @Then all of the coupon codes should be prefixed with :prefix
*/
public function allOfTheCouponsShouldBePrefixedWith(string $prefix): void
public function allOfTheCouponCodesShouldBePrefixedWith(string $prefix): void
{
foreach ($this->indexPage->getCouponCodes() as $couponCode) {
Assert::startsWith($couponCode, $prefix);
}
}

/**
* @Then all of the coupons codes should be suffixed with :prefix
* @Then all of the coupon codes should be suffixed with :suffix
*/
public function allOfTheCouponsShouldBeSuffixedWith(string $suffix): void
public function allOfTheCouponCodesShouldBeSuffixedWith(string $suffix): void
{
foreach ($this->indexPage->getCouponCodes() as $couponCode) {
Assert::endsWith($couponCode, $suffix);
Expand Down Expand Up @@ -408,9 +412,9 @@ public function couponShouldNotExistInTheRegistry(PromotionCouponInterface $coup
}

/**
* @Then I should be notified that it has been successfully generated
* @Then I should be notified that they have been successfully generated
*/
public function iShouldBeNotifiedThatItHasBeenSuccessfullyGenerated()
public function iShouldBeNotifiedThatTheyHaveBeenSuccessfullyGenerated(): void
{
$this->notificationChecker->checkNotification('Success Promotion coupons have been successfully generated.', NotificationType::success());
}
Expand Down

0 comments on commit 1a5dcd2

Please sign in to comment.