Skip to content

Commit 75edacc

Browse files
committed
PB-261: Add Missing Integration P0-P1 Tests For Products
- add integration tests
1 parent 2a210db commit 75edacc

28 files changed

+1826
-22
lines changed

dev/tests/integration/testsuite/Magento/PageBuilder/Model/Catalog/ProductTotalsTest.php

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414

1515
/**
1616
* Class ProductTotalsTest
17-
*
18-
* @magentoAppIsolation enabled
19-
* @magentoDataFixture Magento/PageBuilder/_files/product_totals/products.php
2017
*/
2118
class ProductTotalsTest extends \PHPUnit\Framework\TestCase
2219
{
@@ -35,6 +32,12 @@ protected function setUp()
3532
}
3633

3734
/**
35+
* @magentoAppIsolation enabled
36+
* @magentoDataFixture Magento/PageBuilder/_files/product_totals/products.php
37+
* @magentoDataFixture Magento/PageBuilder/_files/product_totals/configurable_products.php
38+
* @magentoDataFixture Magento/PageBuilder/_files/product_totals/bundle_product.php
39+
* @magentoDataFixture Magento/GroupedProduct/_files/product_grouped_with_simple_out_of_stock.php
40+
* @magentoDataFixture Magento/GiftCard/_files/gift_card.php
3841
* @param array condition
3942
* @param int $expectedTotals
4043
* @dataProvider productDataProvider
@@ -72,7 +75,7 @@ public function productDataProvider()
7275
]
7376
], [0, 0, 0, 0]
7477
],
75-
[ // #1 category with 4 products, 3 disabled, 3 not visible (but 2 not visible disabled)
78+
[ // #1 category with 16 products, 3 disabled, 3 not visible (but 2 not visible disabled), 2 out of stock (1 oos disabled
7679
['1' => [
7780
'aggregator' => 'all',
7881
'new_child' => '',
@@ -85,7 +88,7 @@ public function productDataProvider()
8588
'attribute' => 'category_ids',
8689
'value' => '3'
8790
]
88-
], [8, 3, 1, 1]
91+
], [12, 3, 1, 1]
8992
],
9093
[ // #2 sku with no matches
9194
['1' => [
@@ -102,7 +105,7 @@ public function productDataProvider()
102105
]
103106
], [0, 0, 0, 0]
104107
],
105-
[ // #3 sku with 2 matches, 1 disabled, 1 not visible, 1 out of stock
108+
[ // #3 sku with 2 matches, 1 disabled, 3 not visible, 1 out of stock
106109
['1' => [
107110
'aggregator' => 'all',
108111
'new_child' => '',
@@ -113,9 +116,9 @@ public function productDataProvider()
113116
'operator' => '()',
114117
'type' => \Magento\CatalogWidget\Model\Rule\Condition\Product::class,
115118
'attribute' => 'sku',
116-
'value' => 'not-visible-on-storefront, disabled-product, out-of-stock'
119+
'value' => 'not-visible-on-storefront, disabled-product, out-of-stock, simple_11, simple_21'
117120
]
118-
], [3, 1, 1, 1]
121+
], [5, 1, 3, 1]
119122
],
120123
[ // #4 condition with no matches
121124
['1' => [
@@ -132,7 +135,7 @@ public function productDataProvider()
132135
]
133136
], [0, 0, 0, 0]
134137
],
135-
[ // #5 condition with 3 matches, 1 disabled, 1 not visible
138+
[ // #5 condition with 6 matches, 1 disabled, 2 not visible
136139
['1' => [
137140
'aggregator' => 'all',
138141
'new_child' => '',
@@ -145,7 +148,7 @@ public function productDataProvider()
145148
'attribute' => 'price',
146149
'value' => '20'
147150
]
148-
], [3, 1, 1, 0]
151+
], [6, 1, 2, 0]
149152
],
150153
];
151154
}

dev/tests/integration/testsuite/Magento/PageBuilder/Model/Catalog/SortingTest.php

Lines changed: 154 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
namespace Magento\PageBuilder\Model\Catalog;
88

9+
use Magento\Framework\Exception\NoSuchEntityException;
910
use Magento\TestFramework\Helper\Bootstrap;
1011
use Magento\Catalog\Api\CategoryRepositoryInterface;
1112
use Magento\CatalogWidget\Block\Product\ProductsList;
@@ -66,6 +67,12 @@ protected function setUp()
6667
* @param array $productSortData
6768
* @dataProvider productSortDataProvider
6869
* @magentoDataFixture Magento/PageBuilder/_files/catalog_sorting/products.php
70+
* @magentoDataFixture Magento/PageBuilder/_files/catalog_sorting/bundle_product.php
71+
* @magentoDataFixture Magento/PageBuilder/_files/catalog_sorting/configurable_products.php
72+
* @magentoDataFixture Magento/PageBuilder/_files/catalog_sorting/grouped_product.php
73+
* @magentoDataFixture Magento/PageBuilder/_files/catalog_sorting/product_with_fpt.php
74+
* @magentoDataFixture Magento/PageBuilder/_files/catalog_sorting/downloadable_products.php
75+
* @throws NoSuchEntityException
6976
*/
7077
public function testSortOptions(array $productSortData)
7178
{
@@ -85,9 +92,10 @@ public function testSortOptions(array $productSortData)
8592
`operator`:`()`,
8693
`type`:`Magento||CatalogWidget||Model||Rule||Condition||Product`,
8794
`attribute`:`sku`,
88-
`value`:`B_PB_PRODUCT,a_pb_product,C_PB_PRODUCT,1_PB_PRODUCT`
95+
`value`:`B_PB_PRODUCT,a_pb_product,C_PB_PRODUCT,1_PB_PRODUCT,PB_PRODUCT_CPR,PB_VIRTUAL_PRODUCT,simple_second_website,simple1,simple2,simple3,bundle_product,configurable,simple_11,simple_21,gift-card,grouped,simple_100000001,simple_100000002,simple-with-fpt,downloadable-product-price-on-product,downloadable-product-price-on-link`
8996
^]
90-
^]'
97+
^]',
98+
'products_count' => 99
9199
]
92100
);
93101

@@ -123,6 +131,19 @@ public function productSortDataProvider() : array
123131
[
124132
[
125133
'date_newest_top' => [
134+
'downloadable-product-price-on-link',
135+
'downloadable-product-price-on-product',
136+
'simple-with-fpt',
137+
'configurable',
138+
'bundle_product',
139+
'simple3',
140+
'simple1',
141+
'grouped',
142+
'simple_100000002',
143+
'simple_100000001',
144+
'gift-card',
145+
'PB_VIRTUAL_PRODUCT',
146+
'PB_PRODUCT_CPR',
126147
'1_PB_PRODUCT',
127148
'C_PB_PRODUCT',
128149
'B_PB_PRODUCT',
@@ -132,67 +153,190 @@ public function productSortDataProvider() : array
132153
'a_pb_product',
133154
'B_PB_PRODUCT',
134155
'C_PB_PRODUCT',
135-
'1_PB_PRODUCT'
156+
'1_PB_PRODUCT',
157+
'PB_PRODUCT_CPR',
158+
'PB_VIRTUAL_PRODUCT',
159+
'gift-card',
160+
'simple_100000001',
161+
'simple_100000002',
162+
'grouped',
163+
'simple1',
164+
'simple3',
165+
'bundle_product',
166+
'configurable',
167+
'simple-with-fpt',
168+
'downloadable-product-price-on-product',
169+
'downloadable-product-price-on-link'
136170
],
137171
'name_ascending' => [
138172
'1_PB_PRODUCT',
139173
'a_pb_product',
140174
'B_PB_PRODUCT',
141-
'C_PB_PRODUCT'
175+
'bundle_product',
176+
'C_PB_PRODUCT',
177+
'configurable',
178+
'downloadable-product-price-on-link',
179+
'downloadable-product-price-on-product',
180+
'gift-card',
181+
'grouped',
182+
'PB_PRODUCT_CPR',
183+
'PB_VIRTUAL_PRODUCT',
184+
'simple_100000001',
185+
'simple_100000002',
186+
'simple1',
187+
'simple3',
188+
'simple-with-fpt'
142189
],
143190
'name_descending' => [
191+
'simple-with-fpt',
192+
'simple3',
193+
'simple1',
194+
'simple_100000002',
195+
'simple_100000001',
196+
'PB_VIRTUAL_PRODUCT',
197+
'PB_PRODUCT_CPR',
198+
'grouped',
199+
'gift-card',
200+
'downloadable-product-price-on-product',
201+
'downloadable-product-price-on-link',
202+
'configurable',
144203
'C_PB_PRODUCT',
204+
'bundle_product',
145205
'B_PB_PRODUCT',
146206
'a_pb_product',
147207
'1_PB_PRODUCT'
148208
],
149209
'sku_ascending' => [
150210
'1_PB_PRODUCT',
151211
'a_pb_product',
212+
'bundle_product',
152213
'B_PB_PRODUCT',
153-
'C_PB_PRODUCT'
214+
'configurable',
215+
'C_PB_PRODUCT',
216+
'downloadable-product-price-on-link',
217+
'downloadable-product-price-on-product',
218+
'gift-card',
219+
'grouped',
220+
'PB_PRODUCT_CPR',
221+
'PB_VIRTUAL_PRODUCT',
222+
'simple-with-fpt',
223+
'simple1',
224+
'simple3',
225+
'simple_100000001',
226+
'simple_100000002'
154227
],
155228
'sku_descending' => [
229+
'simple_100000002',
230+
'simple_100000001',
231+
'simple3',
232+
'simple1',
233+
'simple-with-fpt',
234+
'PB_VIRTUAL_PRODUCT',
235+
'PB_PRODUCT_CPR',
236+
'grouped',
237+
'gift-card',
238+
'downloadable-product-price-on-product',
239+
'downloadable-product-price-on-link',
156240
'C_PB_PRODUCT',
241+
'configurable',
157242
'B_PB_PRODUCT',
243+
'bundle_product',
158244
'a_pb_product',
159245
'1_PB_PRODUCT'
160246
],
161247
'low_stock_first' => [
248+
'gift-card',
249+
'grouped',
250+
'configurable',
162251
'B_PB_PRODUCT',
163252
'1_PB_PRODUCT',
164253
'a_pb_product',
254+
'downloadable-product-price-on-product',
255+
'downloadable-product-price-on-link',
256+
'simple_100000002',
257+
'PB_PRODUCT_CPR',
258+
'simple-with-fpt',
259+
'simple_100000001',
260+
'PB_VIRTUAL_PRODUCT',
261+
'simple1',
262+
'bundle_product',
263+
'simple3',
165264
'C_PB_PRODUCT'
166265
],
167266
'high_stock_first' => [
168267
'C_PB_PRODUCT',
268+
'simple3',
269+
'simple1',
270+
'bundle_product',
271+
'PB_VIRTUAL_PRODUCT',
272+
'simple_100000001',
273+
'simple-with-fpt',
274+
'PB_PRODUCT_CPR',
275+
'simple_100000002',
276+
'downloadable-product-price-on-link',
277+
'downloadable-product-price-on-product',
169278
'a_pb_product',
170279
'1_PB_PRODUCT',
171-
'B_PB_PRODUCT'
280+
'B_PB_PRODUCT',
281+
'gift-card',
282+
'configurable',
283+
'grouped'
172284
],
173285
'price_high_to_low' => [
286+
'bundle_product',
174287
'1_PB_PRODUCT',
288+
'PB_VIRTUAL_PRODUCT',
289+
'simple_100000001',
290+
'simple-with-fpt',
291+
'PB_PRODUCT_CPR',
292+
'simple_100000002',
175293
'a_pb_product',
294+
'downloadable-product-price-on-link',
295+
'downloadable-product-price-on-product',
176296
'C_PB_PRODUCT',
177-
'B_PB_PRODUCT'
297+
'simple3',
298+
'simple1',
299+
'gift-card',
300+
'B_PB_PRODUCT',
301+
'configurable',
302+
'grouped'
178303
],
179304
'price_low_to_high' => [
180305
'B_PB_PRODUCT',
306+
'gift-card',
307+
'simple1',
308+
'simple3',
181309
'C_PB_PRODUCT',
310+
'downloadable-product-price-on-product',
311+
'downloadable-product-price-on-link',
182312
'a_pb_product',
183-
'1_PB_PRODUCT'
313+
'simple_100000002',
314+
'PB_PRODUCT_CPR',
315+
'simple-with-fpt',
316+
'simple_100000001',
317+
'PB_VIRTUAL_PRODUCT',
318+
'1_PB_PRODUCT',
319+
'bundle_product',
320+
'configurable',
321+
'grouped'
184322
],
185323
'position' => [
186324
'B_PB_PRODUCT',
187325
'a_pb_product',
188326
'1_PB_PRODUCT',
189-
'C_PB_PRODUCT'
327+
'C_PB_PRODUCT',
328+
'PB_PRODUCT_CPR',
329+
'PB_VIRTUAL_PRODUCT',
330+
'gift-card'
190331
],
191332
'position_by_sku' => [
192333
'B_PB_PRODUCT',
193334
'a_pb_product',
194335
'C_PB_PRODUCT',
195-
'1_PB_PRODUCT'
336+
'1_PB_PRODUCT',
337+
'PB_PRODUCT_CPR',
338+
'PB_VIRTUAL_PRODUCT',
339+
'gift-card'
196340
]
197341
],
198342
]

0 commit comments

Comments
 (0)