File tree Expand file tree Collapse file tree 1 file changed +67
-2
lines changed
app/code/Magento/SalesRule/Test/Fixture Expand file tree Collapse file tree 1 file changed +67
-2
lines changed Original file line number Diff line number Diff line change 11<?php
22/**
3- * Copyright © Magento, Inc. All rights reserved.
4- * See COPYING.txt for license details .
3+ * Copyright 2022 Adobe
4+ * All Rights Reserved .
55 */
66declare (strict_types=1 );
77
1616use Magento \TestFramework \Fixture \Data \ProcessorInterface ;
1717use Magento \TestFramework \Fixture \RevertibleDataFixtureInterface ;
1818
19+ /**
20+ * Cart price rule fixture
21+ *
22+ * Example 1: Using array list: (base_subtotal > 1000) AND (sku in (simple1,simple3))
23+ *
24+ * ```php
25+ * #[
26+ * DataFixture(
27+ * RuleFixture::class,
28+ * [
29+ * 'discount_amount' => 25,
30+ * 'conditions' => [
31+ * [
32+ * 'attribute' => 'base_subtotal',
33+ * 'operator' => '>',
34+ * 'value' => 1000
35+ * ],
36+ * ],
37+ * 'actions' => [
38+ * [
39+ * 'attribute' => 'sku',
40+ * 'operator' => '()',
41+ * 'value' => 'simple1,simple3'
42+ * ]
43+ * ]
44+ * ],
45+ * 'rule'
46+ * )
47+ * ]
48+ * ```
49+ *
50+ * Example 2: Using associative conditions: (category_ids in (1, 2) AND attribute_set_id=default) OR (sku=simple3)
51+ *
52+ * ```php
53+ * #[
54+ * DataFixture(
55+ * RuleFixture::class,
56+ * [
57+ * 'discount_amount' => 25,
58+ * 'actions' => [
59+ * 'aggregator' => 'any',
60+ * 'conditions' => [
61+ * [
62+ * [
63+ * 'attribute' => 'category_ids',
64+ * 'operator' => '()',
65+ * 'value' => '1,2',
66+ * ],
67+ * [
68+ * 'attribute' => 'attribute_set_id',
69+ * 'value' => 'default',
70+ * ],
71+ * ],
72+ * [
73+ * 'attribute' => 'sku',
74+ * 'value' => 'simple3'
75+ * ]
76+ * ],
77+ * ],
78+ * ],
79+ * 'rule'
80+ * )
81+ * ]
82+ * ```
83+ */
1984class Rule implements RevertibleDataFixtureInterface
2085{
2186 private const DEFAULT_DATA = [
You can’t perform that action at this time.
0 commit comments