@@ -109,4 +109,74 @@ public function testEditAction()
109
109
'"Save & Duplicate" button isn \'t present on Edit Product page '
110
110
);
111
111
}
112
+
113
+ /**
114
+ * @dataProvider saveWithInvalidCustomOptionDataProvider
115
+ * @magentoDataFixture Magento/Catalog/_files/product_without_options.php
116
+ */
117
+ public function testSaveWithInvalidCustomOption ($ postData )
118
+ {
119
+ $ this ->getRequest ()->setPostValue ($ postData );
120
+ $ this ->dispatch ('backend/catalog/product/save/id/1 ' );
121
+
122
+ $ this ->assertSessionMessages (
123
+ $ this ->contains ('You saved the product. ' ),
124
+ \Magento \Framework \Message \MessageInterface::TYPE_SUCCESS
125
+ );
126
+ }
127
+
128
+ /**
129
+ * Data Provider for save
130
+ *
131
+ * @return array
132
+ */
133
+ public function saveWithInvalidCustomOptionDataProvider ()
134
+ {
135
+ return [
136
+ [
137
+ [
138
+ 'product ' => [
139
+ 'options ' => [
140
+ [
141
+ 'title ' => 'drop_down option ' ,
142
+ 'type ' => 'drop_down ' ,
143
+ 'is_require ' => true ,
144
+ 'sort_order ' => 0 ,
145
+ 'values ' => [
146
+ [
147
+ 'title ' => 'drop_down option 1 ' ,
148
+ 'price ' => 10 ,
149
+ 'price_type ' => 'fixed ' ,
150
+ 'sku ' => 'drop_down option 1 sku ' ,
151
+ 'option_type_id ' => '-1 ' ,
152
+ 'is_delete ' => '' ,
153
+ 'sort_order ' => 0 ,
154
+ ],
155
+ [
156
+ 'title ' => 'drop_down option 2 ' ,
157
+ 'price ' => 20 ,
158
+ 'price_type ' => 'fixed ' ,
159
+ 'sku ' => 'drop_down option 2 sku ' ,
160
+ 'option_type_id ' => '-1 ' ,
161
+ 'is_delete ' => '' ,
162
+ 'sort_order ' => 1 ,
163
+ ],
164
+ [
165
+ 'title ' => '' ,
166
+ 'price ' => '' ,
167
+ 'price_type ' => 'fixed ' ,
168
+ 'sku ' => '' ,
169
+ 'option_type_id ' => '-1 ' ,
170
+ 'is_delete ' => '1 ' ,
171
+ 'sort_order ' => 2 ,
172
+ ]
173
+ ],
174
+ ]
175
+ ],
176
+ ],
177
+ 'affect_product_custom_options ' => 1 ,
178
+ ]
179
+ ],
180
+ ];
181
+ }
112
182
}
0 commit comments