Skip to content

Commit

Permalink
Merge pull request #4882 from lchrusciel/promotion-feature
Browse files Browse the repository at this point in the history
[Behat] Typo fix in promotion features
  • Loading branch information
Paweł Jędrzejewski committed Apr 29, 2016
2 parents 549eec8 + 000a95e commit 6716d6f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 29 deletions.
Expand Up @@ -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
Expand Up @@ -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"
Expand Up @@ -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
Expand All @@ -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
23 changes: 7 additions & 16 deletions src/Sylius/Behat/Context/Ui/Admin/ManagingPromotionsContext.php
Expand Up @@ -368,29 +368,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);

Expand All @@ -406,7 +397,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()
{
Expand Down

0 comments on commit 6716d6f

Please sign in to comment.