Skip to content

Commit 1d33fed

Browse files
committed
MQE-465: Data object xml support multidimensional arrays; SalesRule metadata, data and api test.
1 parent 9ed7081 commit 1d33fed

File tree

4 files changed

+136
-0
lines changed

4 files changed

+136
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="SimpleSalesRule" type="SalesRule">
12+
<data key="name" unique="suffix">SalesRule</data>
13+
<data key="is_active">true</data>
14+
<required-entity type="SalesRuleStoreLabel">SalesRuleStoreLabel1</required-entity>
15+
<required-entity type="SalesRuleStoreLabel">SalesRuleStoreLabel2</required-entity>
16+
</entity>
17+
<entity name="SalesRuleStoreLabel1" type="SalesRuleStoreLabel">
18+
<data key="store_id">0</data>
19+
<data key="store_label">TestRule_Label</data>
20+
</entity>
21+
<entity name="SalesRuleStoreLabel2" type="SalesRuleStoreLabel">
22+
<data key="store_id">1</data>
23+
<data key="store_label">TestRule_Label_default</data>
24+
</entity>
25+
</config>
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataOperation.xsd">
10+
<operation name="CreateSalesRule" dataType="SalesRule" type="create" auth="adminOauth" url="/V1/salesRules" method="POST">
11+
<contentType>application/json</contentType>
12+
<object key="rule" dataType="SalesRule">
13+
<field key="name" required="true">string</field>
14+
<field key="description">string</field>
15+
<field key="is_active">boolean</field>
16+
<field key="from_date">string</field>
17+
<field key="to_date">string</field>
18+
<field key="uses_per_customer">integer</field>
19+
<field key="sort_order">integer</field>
20+
<field key="simple_action">string</field>
21+
<field key="discount_amount">integer</field>
22+
<field key="discount_qty">integer</field>
23+
<field key="discount_step">integer</field>
24+
<field key="times_used">integer</field>
25+
<field key="uses_per_coupon">integer</field>
26+
<field key="apply_to_shipping">boolean</field>
27+
<field key="is_rss">boolean</field>
28+
<field key="use_auto_generation">boolean</field>
29+
<field key="coupon_type">string</field>
30+
<field key="simple_free_shipping">string</field>
31+
<field key="stop_rules_processing">boolean</field>
32+
<field key="is_advanced">boolean</field>
33+
<array key="store_labels">
34+
<!-- specify object name as array value -->
35+
<value>SalesRuleStoreLabel</value>
36+
<!-- alternatively, define object embedded in array directly -->
37+
<!--object dataType="SalesRuleStoreLabel" key="store_labels">
38+
<field key="store_id">integer</field>
39+
<field key="store_label">string</field>
40+
</object-->
41+
</array>
42+
<array key="product_ids">
43+
<value>integer</value>
44+
</array>
45+
<array key="customer_group_ids">
46+
<value>integer</value>
47+
</array>
48+
<array key="website_ids">
49+
<value>integer</value>
50+
</array>
51+
<object dataType="RuleCondition" key="condition">
52+
<field key="condition_type">string</field>
53+
<array key="conditions">
54+
<value>integer</value>
55+
</array>
56+
<field key="aggregator_type">string</field>
57+
<field key="operator">string</field>
58+
<field key="attribute_name">string</field>
59+
<field key="value">string</field>
60+
<field key="extension_attributes">empty_extension_attribute</field>
61+
</object>
62+
<object dataType="ActionCondition" key="action_condition">
63+
<field key="condition_type">string</field>
64+
<field key="aggregator_type">string</field>
65+
<field key="operator">string</field>
66+
<field key="attribute_name">string</field>
67+
<field key="value">string</field>
68+
<field key="extension_attributes">empty_extension_attribute</field>
69+
</object>
70+
<object dataType="ExtensionAttribute" key="extension_attributes">
71+
<field key="reward_points_delta">integer</field>
72+
</object>
73+
</object>
74+
</operation>
75+
</config>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataOperation.xsd">
11+
<operation name="CreateSalesRuleStoreLabel" dataType="SalesRuleStoreLabel" type="create">
12+
<field key="store_id">integer</field>
13+
<field key="store_label">string</field>
14+
</operation>
15+
</config>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
11+
<cest name="CreateSalesRuleByApiCest">
12+
<annotations>
13+
<features value="Create a Sales Rule By API"/>
14+
<stories value="Create a Sales Rule By API"/>
15+
</annotations>
16+
<before>
17+
<createData mergeKey="saleRule" entity="SimpleSalesRule" />
18+
</before>
19+
<test name="CreateSalesRuleByApiTest"/>
20+
</cest>
21+
</config>

0 commit comments

Comments
 (0)