diff --git a/features/promotion/managing_promotions/adding_promotion.feature b/features/promotion/managing_promotions/adding_promotion.feature index c7edb2d76a2..743a0f82294 100644 --- a/features/promotion/managing_promotions/adding_promotion.feature +++ b/features/promotion/managing_promotions/adding_promotion.feature @@ -62,7 +62,6 @@ Feature: Adding a new promotion Given I want to create a new promotion When I specify its code as "FULL_METAL_PROMOTION" And I name it "Full metal promotion" - And I specify that it should starts at "21.04.2017" - And I specify that it should ends at "21.05.2017" + And I make it available from "21.04.2017" to "21.05.2017" And I add it Then I should be notified that it has been successfully created diff --git a/features/promotion/managing_promotions/editing_promotion.feature b/features/promotion/managing_promotions/editing_promotion.feature index f7ca51fa5c5..a637a3bfe31 100644 --- a/features/promotion/managing_promotions/editing_promotion.feature +++ b/features/promotion/managing_promotions/editing_promotion.feature @@ -49,8 +49,7 @@ Feature: Editing promotion @ui Scenario: Adding a promotion with start and end date Given I want to modify a "Christmas sale" promotion - And I specify that it should starts at "12.12.2017" - And I specify that it should ends at "24.12.2017" + And I make it available from "12.12.2017" to "24.12.2017" And I save my changes Then I should be notified that it has been successfully edited - And the "Christmas sale" promotion should be applicable from "12.12.2017" to "24.12.2017" + And the "Christmas sale" promotion should be available from "12.12.2017" to "24.12.2017" diff --git a/features/promotion/managing_promotions/promotion_validation.feature b/features/promotion/managing_promotions/promotion_validation.feature index dcd701f3767..28cc278353d 100644 --- a/features/promotion/managing_promotions/promotion_validation.feature +++ b/features/promotion/managing_promotions/promotion_validation.feature @@ -27,14 +27,13 @@ Feature: Promotion validation And promotion with code "no_vat_promotion" should not be added @ui - Scenario: Adding a promotion with start date set up after ends date + Scenario: Adding a promotion with start date set up after end date Given I want to create a new promotion When I specify its code as "FULL_METAL_PROMOTION" And I name it "Full metal promotion" - And I specify that it should starts at "24.12.2017" - And I specify that it should ends at "12.12.2017" + And I make it available from "24.12.2017" to "12.12.2017" And I try to add it - Then I should be notified that promotion cannot end before it starts + Then I should be notified that promotion cannot end before it start @ui Scenario: Trying to remove name from existing promotion @@ -46,10 +45,9 @@ Feature: Promotion validation And this promotion should still be named "Christmas sale" @ui - Scenario: Trying to add start later then ends date for existing promotion + Scenario: Trying to add start later then end date for existing promotion Given there is a promotion "Christmas sale" And I want to modify this promotion - And I specify that it should starts at "24.12.2017" - And I specify that it should ends at "12.12.2017" + And I make it available from "24.12.2017" to "12.12.2017" And I try to save my changes - Then I should be notified that promotion cannot end before it starts + Then I should be notified that promotion cannot end before it start diff --git a/src/Sylius/Behat/Context/Ui/Admin/ManagingPromotionsContext.php b/src/Sylius/Behat/Context/Ui/Admin/ManagingPromotionsContext.php index 85da3105bb0..01cb7450a39 100644 --- a/src/Sylius/Behat/Context/Ui/Admin/ManagingPromotionsContext.php +++ b/src/Sylius/Behat/Context/Ui/Admin/ManagingPromotionsContext.php @@ -394,29 +394,20 @@ public function iShouldBeNotifiedOfFailure() } /** - * @When I specify that it should starts at :date + * @When I make it available from :startsDate to :endsDate */ - public function iSpecifyThatItShouldStartAt(\DateTime $date) + public function iMakeItAvailableFromTo(\DateTime $startsDate, \DateTime $endsDate) { $currentPage = $this->currentPageResolver->getCurrentPageWithForm($this->createPage, $this->updatePage); - $currentPage->setStartsAt($date); + $currentPage->setStartsAt($startsDate); + $currentPage->setEndsAt($endsDate); } /** - * @When I specify that it should ends at :date + * @Then the :promotion promotion should be available from :startsDate to :endsDate */ - public function iSpecifyThatItShouldEndsAt(\DateTime $date) - { - $currentPage = $this->currentPageResolver->getCurrentPageWithForm($this->createPage, $this->updatePage); - - $currentPage->setEndsAt($date); - } - - /** - * @Then the :promotion promotion should be applicable from :startsDate to :endsDate - */ - public function thePromotionShouldBeApplicableFromTo(PromotionInterface $promotion, \DateTime $startsDate, \DateTime $endsDate) + public function thePromotionShouldBeAvailableFromTo(PromotionInterface $promotion, \DateTime $startsDate, \DateTime $endsDate) { $this->iWantToModifyAPromotion($promotion); @@ -432,7 +423,7 @@ public function thePromotionShouldBeApplicableFromTo(PromotionInterface $promoti } /** - * @Then I should be notified that promotion cannot end before it starts + * @Then I should be notified that promotion cannot end before it start */ public function iShouldBeNotifiedThatPromotionCannotEndBeforeItsEvenStart() {