$ruleId = 'cb34dc6f20b6479aa975e1290f442e65';
$this->
createRule($ruleId);
$progress =
$this->
import($context, PromotionDiscountDefinition::ENTITY_NAME, '/fixtures/promotion_discounts.csv', 'promotion_discounts.csv'
);
static::
assertImportExportSucceeded($progress,
$this->
getInvalidLogContent($progress->
getInvalidRecordsLogId()));
/** @var PromotionEntity $promotion */
$promotion =
$this->
getContainer()->
get('promotion.repository'
)->
search((new Criteria([$promotionId]))->
addAssociation('discounts.discountRules'
),
$context)->
first();
static::
assertInstanceOf(PromotionDiscountCollection::
class,
$discounts =
$promotion->
getDiscounts());
static::
assertCount(2,
$discounts);
$firstDiscount =
$discounts->
first();
static::
assertInstanceOf(PromotionDiscountEntity::
class,
$firstDiscount);
static::
assertEquals('cart',
$firstDiscount->
getScope());
static::
assertEquals('absolute',
$firstDiscount->
getType());
static::
assertEquals(5,
$firstDiscount->
getValue());
static::
assertFalse($firstDiscount->
isConsiderAdvancedRules());
static::
assertNull($firstDiscount->
getMaxValue());
static::
assertEquals('PRICE_ASC',
$firstDiscount->
getSorterKey());
static::
assertEquals('ALL',
$firstDiscount->
getApplierKey());