File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
dev/tests/integration/testsuite/Magento/ImportExport/Model/Export Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -93,8 +93,28 @@ public function testProcess(): void
9393 $ this ->assertTrue ($ this ->directory ->isExist ($ this ->filePath ));
9494 $ data = $ this ->csvReader ->getData ($ this ->directory ->getAbsolutePath ($ this ->filePath ));
9595 $ this ->assertCount (2 , $ data );
96- $ skuPosition = array_search (ProductInterface:: SKU , array_keys ( $ data) );
96+ $ skuPosition = $ this -> getSkuPosition ( $ data );
9797 $ this ->assertNotFalse ($ skuPosition );
9898 $ this ->assertEquals ('simple2 ' , $ data [1 ][$ skuPosition ]);
9999 }
100+
101+ /**
102+ * Get sku position from array.
103+ *
104+ * @param array $csvFileData
105+ *
106+ * @return bool|int
107+ */
108+ private function getSkuPosition (array $ csvFileData )
109+ {
110+ foreach ($ csvFileData as $ data ) {
111+ $ skuPosition = array_search (ProductInterface::SKU , $ data );
112+
113+ if ($ skuPosition !== false ) {
114+ return $ skuPosition ;
115+ }
116+ }
117+
118+ return false ;
119+ }
100120}
You can’t perform that action at this time.
0 commit comments