PHP Class Sylius\Behat\Context\Setup\PromotionContext

Author: Mateusz Zalewski ([email protected])
Inheritance: implements Behat\Behat\Context\Context
Show file Open project: sylius/sylius

Public Methods

Method Description
__construct ( Sylius\Behat\Service\SharedStorageInterface $sharedStorage, Sylius\Component\Core\Factory\PromotionActionFactoryInterface $actionFactory, Sylius\Component\Promotion\Factory\PromotionCouponFactoryInterface $couponFactory, Sylius\Component\Core\Factory\PromotionRuleFactoryInterface $ruleFactory, Sylius\Component\Core\Test\Factory\TestPromotionFactoryInterface $testPromotionFactory, Sylius\Component\Promotion\Repository\PromotionRepositoryInterface $promotionRepository, Doctrine\Common\Persistence\ObjectManager $objectManager )
itGivesFixedDiscountOffOnAProduct ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, Sylius\Component\Core\Model\ProductInterface $product )
itGivesFixedDiscountToEveryOrder ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount )
itGivesFixedDiscountToEveryOrderWithItemsTotalAtLeast ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, $targetAmount )
itGivesFixedDiscountToEveryOrderWithQuantityAtLeast ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, $quantity )
itGivesFixedOffCustomersNthOrder ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, $nth )
itGivesFixedOffEveryProductClassifiedAs ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, Sylius\Component\Core\Model\TaxonInterface $taxon )
itGivesOffOnEveryItemWhenItemTotalExceeds ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, $targetAmount )
itGivesOffOnEveryProductClassifiedAsAndAFixedDiscountToEveryOrderWithItemsTotalEqualAtLeast ( Sylius\Component\Core\Model\PromotionInterface $promotion, $taxonDiscount, Sylius\Component\Core\Model\TaxonInterface $taxon, $orderDiscount, $targetAmount )
itGivesOffOnEveryProductClassifiedAsAndAFreeShippingToEveryOrderWithItemsTotalEqualAtLeast ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, Sylius\Component\Core\Model\TaxonInterface $taxon, $targetAmount )
itGivesOffOnEveryProductClassifiedAsIfOrderContainsAnyProductClassifiedAs ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, $discountTaxon, $targetTaxon )
itGivesOffOnEveryProductClassifiedAsOrIfOrderContainsAnyProductClassifiedAsOr ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, array $discountTaxons, array $targetTaxons )
itGivesPercentageDiscountOffOnAProduct ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, Sylius\Component\Core\Model\ProductInterface $product )
itGivesPercentageDiscountOnShippingToEveryOrder ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount )
itGivesPercentageDiscountToEveryOrder ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount )
itGivesPercentageOffCustomersNthOrder ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, $nth )
itGivesPercentageOffEveryProductClassifiedAs ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, Sylius\Component\Core\Model\TaxonInterface $taxon )
itGivesPercentageOffOnEveryProductClassifiedAsAndAmountDiscountOnOrder ( Sylius\Component\Core\Model\PromotionInterface $promotion, $productDiscount, Sylius\Component\Core\Model\TaxonInterface $discountTaxon, $orderDiscount )
itIsCouponBasedPromotion ( Sylius\Component\Core\Model\PromotionInterface $promotion )
theCouponWasUsed ( Sylius\Component\Core\Model\PromotionCouponInterface $coupon )
thePromotionGivesFreeShippingToEveryOrder ( Sylius\Component\Core\Model\PromotionInterface $promotion )
thePromotionGivesOffIfOrderContainsProducts ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, Sylius\Component\Core\Model\ProductInterface $product )
thePromotionGivesOffIfOrderContainsProductsClassifiedAs ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, Sylius\Component\Core\Model\TaxonInterface $taxon )
thePromotionGivesOffIfOrderContainsProductsClassifiedAsAndPricedAt ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, Sylius\Component\Core\Model\TaxonInterface $taxon, $amount )
thePromotionGivesOffIfOrderContainsProductsClassifiedAsOr ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, array $taxons )
thePromotionWasDisabledForTheChannel ( Sylius\Component\Core\Model\PromotionInterface $promotion, Sylius\Component\Core\Model\ChannelInterface $channel )
thereIsAPromotionWithPriority ( $promotionName, $priority )
thereIsAnExclusivePromotionWithPriority ( $promotionName, $priority )
thereIsPromotion ( $promotionName, $promotionCode = null )
thereIsPromotionLimitedToUsages ( $promotionName, $usageLimit )
thereIsPromotionWithCoupon ( $promotionName, $couponCode, $usageLimit = null )
thisCouponCanBeUsedNTimes ( Sylius\Component\Core\Model\PromotionCouponInterface $coupon, $usageLimit )
thisCouponCanBeUsedTwicePerCustomer ( Sylius\Component\Core\Model\PromotionCouponInterface $coupon )
thisCouponExpiresTomorrow ( Sylius\Component\Core\Model\PromotionCouponInterface $coupon )
thisCouponHasExpired ( Sylius\Component\Core\Model\PromotionCouponInterface $coupon )
thisCouponHasReachedItsUsageLimit ( Sylius\Component\Core\Model\PromotionCouponInterface $coupon )
thisPromotionGivesDiscountToEveryOrderInTheChannelAndDiscountToEveryOrderInTheChannel ( Sylius\Component\Core\Model\PromotionInterface $promotion, $firstChannelDiscount, Sylius\Component\Core\Model\ChannelInterface $firstChannel, $secondChannelDiscount, Sylius\Component\Core\Model\ChannelInterface $secondChannel )
thisPromotionGivesInDifferentCurrenciesOffOnEveryProductWithMinimumPriceAt ( Sylius\Component\Core\Model\PromotionInterface $promotion, $baseDiscount, $currencyDiscount, $currencyCode, $minimumPrice )
thisPromotionGivesOffOnEveryProductPricedBetween ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, $minAmount, $maxAmount )
thisPromotionGivesOffOnEveryProductWithMinimumPriceAt ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, $amount )
thisPromotionHasExpired ( Sylius\Component\Core\Model\PromotionInterface $promotion )
thisPromotionPercentageGivesOffOnEveryProductPricedBetween ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, $minAmount, $maxAmount )
thisPromotionPercentageGivesOffOnEveryProductWithMinimumPriceAt ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, $amount )

Private Methods

Method Description
createFixedPromotion ( Sylius\Component\Core\Model\PromotionInterface $promotion, integer $discount, array $configuration = [], Sylius\Component\Promotion\Model\PromotionRuleInterface $rule = null, Sylius\Component\Core\Model\ChannelInterface $channel = null )
createPercentagePromotion ( Sylius\Component\Core\Model\PromotionInterface $promotion, float $discount, array $configuration = [], Sylius\Component\Promotion\Model\PromotionRuleInterface $rule = null )
createUnitFixedPromotion ( Sylius\Component\Core\Model\PromotionInterface $promotion, integer $discount, array $configuration = [], Sylius\Component\Promotion\Model\PromotionRuleInterface $rule = null )
createUnitPercentagePromotion ( Sylius\Component\Core\Model\PromotionInterface $promotion, integer $discount, array $configuration = [], Sylius\Component\Promotion\Model\PromotionRuleInterface $rule = null )
getPriceRangeFilterConfiguration ( integer $minAmount, integer $maxAmount = null ) : array
getProductsFilterConfiguration ( array $productCodes ) : array
getTaxonFilterConfiguration ( array $taxonCodes ) : array
persistPromotion ( Sylius\Component\Core\Model\PromotionInterface $promotion, Sylius\Component\Promotion\Model\PromotionActionInterface $action, array $configuration, Sylius\Component\Promotion\Model\PromotionRuleInterface $rule = null )

Method Details

__construct() public method

public __construct ( Sylius\Behat\Service\SharedStorageInterface $sharedStorage, Sylius\Component\Core\Factory\PromotionActionFactoryInterface $actionFactory, Sylius\Component\Promotion\Factory\PromotionCouponFactoryInterface $couponFactory, Sylius\Component\Core\Factory\PromotionRuleFactoryInterface $ruleFactory, Sylius\Component\Core\Test\Factory\TestPromotionFactoryInterface $testPromotionFactory, Sylius\Component\Promotion\Repository\PromotionRepositoryInterface $promotionRepository, Doctrine\Common\Persistence\ObjectManager $objectManager )
$sharedStorage Sylius\Behat\Service\SharedStorageInterface
$actionFactory Sylius\Component\Core\Factory\PromotionActionFactoryInterface
$couponFactory Sylius\Component\Promotion\Factory\PromotionCouponFactoryInterface
$ruleFactory Sylius\Component\Core\Factory\PromotionRuleFactoryInterface
$testPromotionFactory Sylius\Component\Core\Test\Factory\TestPromotionFactoryInterface
$promotionRepository Sylius\Component\Promotion\Repository\PromotionRepositoryInterface
$objectManager Doctrine\Common\Persistence\ObjectManager

itGivesFixedDiscountOffOnAProduct() public method

public itGivesFixedDiscountOffOnAProduct ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, Sylius\Component\Core\Model\ProductInterface $product )
$promotion Sylius\Component\Core\Model\PromotionInterface
$product Sylius\Component\Core\Model\ProductInterface

itGivesFixedDiscountToEveryOrder() public method

public itGivesFixedDiscountToEveryOrder ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount )
$promotion Sylius\Component\Core\Model\PromotionInterface

itGivesFixedDiscountToEveryOrderWithItemsTotalAtLeast() public method

public itGivesFixedDiscountToEveryOrderWithItemsTotalAtLeast ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, $targetAmount )
$promotion Sylius\Component\Core\Model\PromotionInterface

itGivesFixedDiscountToEveryOrderWithQuantityAtLeast() public method

public itGivesFixedDiscountToEveryOrderWithQuantityAtLeast ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, $quantity )
$promotion Sylius\Component\Core\Model\PromotionInterface

itGivesFixedOffCustomersNthOrder() public method

public itGivesFixedOffCustomersNthOrder ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, $nth )
$promotion Sylius\Component\Core\Model\PromotionInterface

itGivesFixedOffEveryProductClassifiedAs() public method

public itGivesFixedOffEveryProductClassifiedAs ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, Sylius\Component\Core\Model\TaxonInterface $taxon )
$promotion Sylius\Component\Core\Model\PromotionInterface
$taxon Sylius\Component\Core\Model\TaxonInterface

itGivesOffOnEveryItemWhenItemTotalExceeds() public method

public itGivesOffOnEveryItemWhenItemTotalExceeds ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, $targetAmount )
$promotion Sylius\Component\Core\Model\PromotionInterface

itGivesOffOnEveryProductClassifiedAsAndAFixedDiscountToEveryOrderWithItemsTotalEqualAtLeast() public method

public itGivesOffOnEveryProductClassifiedAsAndAFixedDiscountToEveryOrderWithItemsTotalEqualAtLeast ( Sylius\Component\Core\Model\PromotionInterface $promotion, $taxonDiscount, Sylius\Component\Core\Model\TaxonInterface $taxon, $orderDiscount, $targetAmount )
$promotion Sylius\Component\Core\Model\PromotionInterface
$taxon Sylius\Component\Core\Model\TaxonInterface

itGivesOffOnEveryProductClassifiedAsAndAFreeShippingToEveryOrderWithItemsTotalEqualAtLeast() public method

public itGivesOffOnEveryProductClassifiedAsAndAFreeShippingToEveryOrderWithItemsTotalEqualAtLeast ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, Sylius\Component\Core\Model\TaxonInterface $taxon, $targetAmount )
$promotion Sylius\Component\Core\Model\PromotionInterface
$taxon Sylius\Component\Core\Model\TaxonInterface

itGivesOffOnEveryProductClassifiedAsIfOrderContainsAnyProductClassifiedAs() public method

public itGivesOffOnEveryProductClassifiedAsIfOrderContainsAnyProductClassifiedAs ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, $discountTaxon, $targetTaxon )
$promotion Sylius\Component\Core\Model\PromotionInterface

itGivesOffOnEveryProductClassifiedAsOrIfOrderContainsAnyProductClassifiedAsOr() public method

public itGivesOffOnEveryProductClassifiedAsOrIfOrderContainsAnyProductClassifiedAsOr ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, array $discountTaxons, array $targetTaxons )
$promotion Sylius\Component\Core\Model\PromotionInterface
$discountTaxons array
$targetTaxons array

itGivesPercentageDiscountOffOnAProduct() public method

public itGivesPercentageDiscountOffOnAProduct ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, Sylius\Component\Core\Model\ProductInterface $product )
$promotion Sylius\Component\Core\Model\PromotionInterface
$product Sylius\Component\Core\Model\ProductInterface

itGivesPercentageDiscountOnShippingToEveryOrder() public method

public itGivesPercentageDiscountOnShippingToEveryOrder ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount )
$promotion Sylius\Component\Core\Model\PromotionInterface

itGivesPercentageDiscountToEveryOrder() public method

public itGivesPercentageDiscountToEveryOrder ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount )
$promotion Sylius\Component\Core\Model\PromotionInterface

itGivesPercentageOffCustomersNthOrder() public method

public itGivesPercentageOffCustomersNthOrder ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, $nth )
$promotion Sylius\Component\Core\Model\PromotionInterface

itGivesPercentageOffEveryProductClassifiedAs() public method

public itGivesPercentageOffEveryProductClassifiedAs ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, Sylius\Component\Core\Model\TaxonInterface $taxon )
$promotion Sylius\Component\Core\Model\PromotionInterface
$taxon Sylius\Component\Core\Model\TaxonInterface

itGivesPercentageOffOnEveryProductClassifiedAsAndAmountDiscountOnOrder() public method

public itGivesPercentageOffOnEveryProductClassifiedAsAndAmountDiscountOnOrder ( Sylius\Component\Core\Model\PromotionInterface $promotion, $productDiscount, Sylius\Component\Core\Model\TaxonInterface $discountTaxon, $orderDiscount )
$promotion Sylius\Component\Core\Model\PromotionInterface
$discountTaxon Sylius\Component\Core\Model\TaxonInterface

itIsCouponBasedPromotion() public method

public itIsCouponBasedPromotion ( Sylius\Component\Core\Model\PromotionInterface $promotion )
$promotion Sylius\Component\Core\Model\PromotionInterface

theCouponWasUsed() public method

public theCouponWasUsed ( Sylius\Component\Core\Model\PromotionCouponInterface $coupon )
$coupon Sylius\Component\Core\Model\PromotionCouponInterface

thePromotionGivesFreeShippingToEveryOrder() public method

public thePromotionGivesFreeShippingToEveryOrder ( Sylius\Component\Core\Model\PromotionInterface $promotion )
$promotion Sylius\Component\Core\Model\PromotionInterface

thePromotionGivesOffIfOrderContainsProducts() public method

public thePromotionGivesOffIfOrderContainsProducts ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, Sylius\Component\Core\Model\ProductInterface $product )
$promotion Sylius\Component\Core\Model\PromotionInterface
$product Sylius\Component\Core\Model\ProductInterface

thePromotionGivesOffIfOrderContainsProductsClassifiedAs() public method

public thePromotionGivesOffIfOrderContainsProductsClassifiedAs ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, Sylius\Component\Core\Model\TaxonInterface $taxon )
$promotion Sylius\Component\Core\Model\PromotionInterface
$taxon Sylius\Component\Core\Model\TaxonInterface

thePromotionGivesOffIfOrderContainsProductsClassifiedAsAndPricedAt() public method

public thePromotionGivesOffIfOrderContainsProductsClassifiedAsAndPricedAt ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, Sylius\Component\Core\Model\TaxonInterface $taxon, $amount )
$promotion Sylius\Component\Core\Model\PromotionInterface
$taxon Sylius\Component\Core\Model\TaxonInterface

thePromotionGivesOffIfOrderContainsProductsClassifiedAsOr() public method

public thePromotionGivesOffIfOrderContainsProductsClassifiedAsOr ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, array $taxons )
$promotion Sylius\Component\Core\Model\PromotionInterface
$taxons array

thePromotionWasDisabledForTheChannel() public method

public thePromotionWasDisabledForTheChannel ( Sylius\Component\Core\Model\PromotionInterface $promotion, Sylius\Component\Core\Model\ChannelInterface $channel )
$promotion Sylius\Component\Core\Model\PromotionInterface
$channel Sylius\Component\Core\Model\ChannelInterface

thereIsAPromotionWithPriority() public method

public thereIsAPromotionWithPriority ( $promotionName, $priority )

thereIsAnExclusivePromotionWithPriority() public method

public thereIsAnExclusivePromotionWithPriority ( $promotionName, $priority )

thereIsPromotion() public method

public thereIsPromotion ( $promotionName, $promotionCode = null )

thereIsPromotionLimitedToUsages() public method

public thereIsPromotionLimitedToUsages ( $promotionName, $usageLimit )

thereIsPromotionWithCoupon() public method

public thereIsPromotionWithCoupon ( $promotionName, $couponCode, $usageLimit = null )

thisCouponCanBeUsedNTimes() public method

public thisCouponCanBeUsedNTimes ( Sylius\Component\Core\Model\PromotionCouponInterface $coupon, $usageLimit )
$coupon Sylius\Component\Core\Model\PromotionCouponInterface

thisCouponCanBeUsedTwicePerCustomer() public method

public thisCouponCanBeUsedTwicePerCustomer ( Sylius\Component\Core\Model\PromotionCouponInterface $coupon )
$coupon Sylius\Component\Core\Model\PromotionCouponInterface

thisCouponExpiresTomorrow() public method

public thisCouponExpiresTomorrow ( Sylius\Component\Core\Model\PromotionCouponInterface $coupon )
$coupon Sylius\Component\Core\Model\PromotionCouponInterface

thisCouponHasExpired() public method

public thisCouponHasExpired ( Sylius\Component\Core\Model\PromotionCouponInterface $coupon )
$coupon Sylius\Component\Core\Model\PromotionCouponInterface

thisCouponHasReachedItsUsageLimit() public method

public thisCouponHasReachedItsUsageLimit ( Sylius\Component\Core\Model\PromotionCouponInterface $coupon )
$coupon Sylius\Component\Core\Model\PromotionCouponInterface

thisPromotionGivesDiscountToEveryOrderInTheChannelAndDiscountToEveryOrderInTheChannel() public method

public thisPromotionGivesDiscountToEveryOrderInTheChannelAndDiscountToEveryOrderInTheChannel ( Sylius\Component\Core\Model\PromotionInterface $promotion, $firstChannelDiscount, Sylius\Component\Core\Model\ChannelInterface $firstChannel, $secondChannelDiscount, Sylius\Component\Core\Model\ChannelInterface $secondChannel )
$promotion Sylius\Component\Core\Model\PromotionInterface
$firstChannel Sylius\Component\Core\Model\ChannelInterface
$secondChannel Sylius\Component\Core\Model\ChannelInterface

thisPromotionGivesInDifferentCurrenciesOffOnEveryProductWithMinimumPriceAt() public method

public thisPromotionGivesInDifferentCurrenciesOffOnEveryProductWithMinimumPriceAt ( Sylius\Component\Core\Model\PromotionInterface $promotion, $baseDiscount, $currencyDiscount, $currencyCode, $minimumPrice )
$promotion Sylius\Component\Core\Model\PromotionInterface

thisPromotionGivesOffOnEveryProductPricedBetween() public method

public thisPromotionGivesOffOnEveryProductPricedBetween ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, $minAmount, $maxAmount )
$promotion Sylius\Component\Core\Model\PromotionInterface

thisPromotionGivesOffOnEveryProductWithMinimumPriceAt() public method

public thisPromotionGivesOffOnEveryProductWithMinimumPriceAt ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, $amount )
$promotion Sylius\Component\Core\Model\PromotionInterface

thisPromotionHasExpired() public method

public thisPromotionHasExpired ( Sylius\Component\Core\Model\PromotionInterface $promotion )
$promotion Sylius\Component\Core\Model\PromotionInterface

thisPromotionPercentageGivesOffOnEveryProductPricedBetween() public method

public thisPromotionPercentageGivesOffOnEveryProductPricedBetween ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, $minAmount, $maxAmount )
$promotion Sylius\Component\Core\Model\PromotionInterface

thisPromotionPercentageGivesOffOnEveryProductWithMinimumPriceAt() public method

public thisPromotionPercentageGivesOffOnEveryProductWithMinimumPriceAt ( Sylius\Component\Core\Model\PromotionInterface $promotion, $discount, $amount )
$promotion Sylius\Component\Core\Model\PromotionInterface