@@ -84,8 +84,10 @@ protected function setUp()
8484 /**
8585 * @magentoDataFixture Magento/CatalogImportExport/_files/product_export_data.php
8686 * @magentoDbIsolation enabled
87+ *
88+ * @return void
8789 */
88- public function testExport ()
90+ public function testExport (): void
8991 {
9092 $ this ->model ->setWriter (
9193 $ this ->objectManager ->create (
@@ -109,8 +111,10 @@ public function testExport()
109111 /**
110112 * @magentoDataFixture Magento/CatalogImportExport/_files/product_export_data_special_chars.php
111113 * @magentoDbIsolation enabled
114+ *
115+ * @return void
112116 */
113- public function testExportSpecialChars ()
117+ public function testExportSpecialChars (): void
114118 {
115119 $ this ->model ->setWriter (
116120 $ this ->objectManager ->create (
@@ -125,8 +129,10 @@ public function testExportSpecialChars()
125129 /**
126130 * @magentoDataFixture Magento/CatalogImportExport/_files/product_export_with_product_links_data.php
127131 * @magentoDbIsolation enabled
132+ *
133+ * @return void
128134 */
129- public function testExportWithProductLinks ()
135+ public function testExportWithProductLinks (): void
130136 {
131137 $ this ->model ->setWriter (
132138 \Magento \TestFramework \Helper \Bootstrap::getObjectManager ()->create (
@@ -143,8 +149,10 @@ public function testExportWithProductLinks()
143149 * @magentoDbIsolation enabled
144150 * @covers \Magento\CatalogImportExport\Model\Export\Product::export
145151 * @magentoDataFixture Magento/CatalogImportExport/_files/product_export_data.php
152+ *
153+ * @return void
146154 */
147- public function testExportStockItemAttributesAreFilled ()
155+ public function testExportStockItemAttributesAreFilled (): void
148156 {
149157 $ this ->markTestSkipped ('Test needs to be skipped. ' );
150158 $ fileWrite = $ this ->createMock (\Magento \Framework \Filesystem \File \Write::class);
@@ -176,8 +184,9 @@ public function testExportStockItemAttributesAreFilled()
176184 * Verify header columns (that stock item attributes column headers are present)
177185 *
178186 * @param array $headerColumns
187+ * @return void
179188 */
180- public function verifyHeaderColumns (array $ headerColumns )
189+ public function verifyHeaderColumns (array $ headerColumns ): void
181190 {
182191 foreach (self ::$ stockItemAttributes as $ stockItemAttribute ) {
183192 $ this ->assertContains (
@@ -192,8 +201,9 @@ public function verifyHeaderColumns(array $headerColumns)
192201 * Verify row data (stock item attribute values)
193202 *
194203 * @param array $rowData
204+ * @return void
195205 */
196- public function verifyRow (array $ rowData )
206+ public function verifyRow (array $ rowData ): void
197207 {
198208 foreach (self ::$ stockItemAttributes as $ stockItemAttribute ) {
199209 $ this ->assertNotSame (
@@ -208,8 +218,10 @@ public function verifyRow(array $rowData)
208218 * Verifies if exception processing works properly
209219 * @magentoDbIsolation enabled
210220 * @magentoDataFixture Magento/CatalogImportExport/_files/product_export_data.php
221+ *
222+ * @return void
211223 */
212- public function testExceptionInGetExportData ()
224+ public function testExceptionInGetExportData (): void
213225 {
214226 $ this ->markTestSkipped ('Test needs to be skipped. ' );
215227 $ exception = new \Exception ('Error ' );
@@ -258,8 +270,10 @@ public function testExceptionInGetExportData()
258270 * Verify if fields wrapping works correct when "Fields Enclosure" option enabled
259271 *
260272 * @magentoDataFixture Magento/CatalogImportExport/_files/product_export_data.php
273+ *
274+ * @return void
261275 */
262- public function testExportWithFieldsEnclosure ()
276+ public function testExportWithFieldsEnclosure (): void
263277 {
264278 $ this ->model ->setParameters (
265279 [
@@ -284,8 +298,10 @@ public function testExportWithFieldsEnclosure()
284298 * Verify that "category ids" filter correctly applies to export result
285299 *
286300 * @magentoDataFixture Magento/CatalogImportExport/_files/product_export_with_categories.php
301+ *
302+ * @return void
287303 */
288- public function testCategoryIdsFilter ()
304+ public function testCategoryIdsFilter (): void
289305 {
290306 $ this ->model ->setWriter (
291307 $ this ->objectManager ->create (
@@ -313,8 +329,10 @@ public function testCategoryIdsFilter()
313329 * Verify that export processed successfully with wrong category path
314330 *
315331 * @magentoDataFixture Magento/CatalogImportExport/_files/product_export_with_broken_categories_path.php
332+ *
333+ * @return void
316334 */
317- public function testExportWithWrongCategoryPath ()
335+ public function testExportWithWrongCategoryPath (): void
318336 {
319337 $ this ->model ->setWriter (
320338 $ this ->objectManager ->create (
@@ -329,8 +347,10 @@ public function testExportWithWrongCategoryPath()
329347 * Test 'hide from product page' export for non-default store.
330348 *
331349 * @magentoDataFixture Magento/CatalogImportExport/_files/product_export_with_images.php
350+ *
351+ * @return void
332352 */
333- public function testExportWithMedia ()
353+ public function testExportWithMedia (): void
334354 {
335355 /** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */
336356 $ productRepository = $ this ->objectManager ->get (\Magento \Catalog \Api \ProductRepositoryInterface::class);
@@ -359,6 +379,7 @@ public function testExportWithMedia()
359379
360380 /**
361381 * @magentoDataFixture Magento/CatalogImportExport/_files/product_export_data.php
382+ *
362383 * @return void
363384 */
364385 public function testExportWithCustomOptions (): void
@@ -403,12 +424,19 @@ public function testExportWithCustomOptions(): void
403424 /** @var \Magento\Framework\File\Csv $csv */
404425 $ csv = $ this ->objectManager ->get (\Magento \Framework \File \Csv::class);
405426 $ data = $ csv ->getData ($ varDirectory ->getAbsolutePath ('test_product_with_custom_options_and_second_store.csv ' ));
427+ $ keys = array_shift ($ data );
428+ $ products = [];
429+ foreach ($ data as $ productData ) {
430+ $ products [] = array_combine ($ keys , $ productData );
431+ }
432+ $ products = array_filter ($ products , function (array $ product ) {
433+ return $ product ['sku ' ] === 'simple ' ;
434+ });
406435 $ customOptionData = [];
407- foreach ($ data [0 ] as $ columnNumber => $ columnName ) {
408- if ($ columnName === 'custom_options ' ) {
409- $ customOptionData ['admin_store ' ] = $ this ->parseExportedCustomOption ($ data [1 ][$ columnNumber ]);
410- $ customOptionData [$ storeCode ] = $ this ->parseExportedCustomOption ($ data [2 ][$ columnNumber ]);
411- }
436+
437+ foreach ($ products as $ product ) {
438+ $ storeCode = $ product ['store_view_code ' ] ?: 'admin_store ' ;
439+ $ customOptionData [$ storeCode ] = $ this ->parseExportedCustomOption ($ product ['custom_options ' ]);
412440 }
413441
414442 self ::assertSame ($ expectedData , $ customOptionData );
@@ -418,8 +446,10 @@ public function testExportWithCustomOptions(): void
418446 * Check that no duplicate entities when multiple custom options used
419447 *
420448 * @magentoDataFixture Magento/Catalog/_files/product_simple_with_options.php
449+ *
450+ * @return void
421451 */
422- public function testExportWithMultipleOptions ()
452+ public function testExportWithMultipleOptions (): void
423453 {
424454 $ expectedCount = 1 ;
425455 $ resultsFilename = 'export_results.csv ' ;
@@ -442,6 +472,8 @@ public function testExportWithMultipleOptions()
442472 }
443473
444474 /**
475+ * Parse exported custom options
476+ *
445477 * @param string $exportedCustomOption
446478 * @return array
447479 */
@@ -476,8 +508,10 @@ function ($input) {
476508 * @magentoConfigFixture current_store catalog/price/scope 1
477509 * @magentoDbIsolation disabled
478510 * @magentoAppArea adminhtml
511+ *
512+ * @return void
479513 */
480- public function testExportProductWithTwoWebsites ()
514+ public function testExportProductWithTwoWebsites (): void
481515 {
482516 $ globalStoreCode = 'admin ' ;
483517 $ secondStoreCode = 'fixture_second_store ' ;
@@ -539,17 +573,19 @@ public function testExportProductWithTwoWebsites()
539573 /**
540574 * Verify that "stock status" filter correctly applies to export result
541575 *
576+ * @magentoDataFixture Magento/Catalog/_files/multiple_products_with_few_out_of_stock.php
577+ * @dataProvider filterByQuantityAndStockStatusDataProvider
578+ *
542579 * @param string $value
543580 * @param array $productsIncluded
544581 * @param array $productsNotIncluded
545- * @magentoDataFixture Magento/Catalog/_files/multiple_products_with_few_out_of_stock.php
546- * @dataProvider filterByQuantityAndStockStatusDataProvider
582+ * @return void
547583 */
548584 public function testFilterByQuantityAndStockStatus (
549585 string $ value ,
550586 array $ productsIncluded ,
551587 array $ productsNotIncluded
552- ) {
588+ ): void {
553589 $ exportData = $ this ->doExport (['quantity_and_stock_status ' => $ value ]);
554590 foreach ($ productsIncluded as $ productName ) {
555591 $ this ->assertContains ($ productName , $ exportData );
@@ -569,35 +605,37 @@ public function filterByQuantityAndStockStatusDataProvider(): array
569605 [
570606 'Simple Product OOS ' ,
571607 'Simple Product Not Visible ' ,
572- 'Simple Product Visible and InStock '
608+ 'Simple Product Visible and InStock ' ,
573609 ],
574610 [
575- ]
611+ ],
576612 ],
577613 [
578614 '1 ' ,
579615 [
580616 'Simple Product Not Visible ' ,
581- 'Simple Product Visible and InStock '
617+ 'Simple Product Visible and InStock ' ,
582618 ],
583619 [
584- 'Simple Product OOS '
585- ]
620+ 'Simple Product OOS ' ,
621+ ],
586622 ],
587623 [
588624 '0 ' ,
589625 [
590- 'Simple Product OOS '
626+ 'Simple Product OOS ' ,
591627 ],
592628 [
593629 'Simple Product Not Visible ' ,
594- 'Simple Product Visible and InStock '
595- ]
596- ]
630+ 'Simple Product Visible and InStock ' ,
631+ ],
632+ ],
597633 ];
598634 }
599635
600636 /**
637+ * Perform export
638+ *
601639 * @param array $filters
602640 * @return string
603641 */
0 commit comments