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
93
93
$ this ->assertTrue ($ this ->directory ->isExist ($ this ->filePath ));
94
94
$ data = $ this ->csvReader ->getData ($ this ->directory ->getAbsolutePath ($ this ->filePath ));
95
95
$ this ->assertCount (2 , $ data );
96
- $ skuPosition = array_search (ProductInterface:: SKU , array_keys ( $ data) );
96
+ $ skuPosition = $ this -> getSkuPosition ( $ data );
97
97
$ this ->assertNotFalse ($ skuPosition );
98
98
$ this ->assertEquals ('simple2 ' , $ data [1 ][$ skuPosition ]);
99
99
}
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
+ }
100
120
}
You can’t perform that action at this time.
0 commit comments