@@ -68,6 +68,11 @@ abstract class AbstractProductExportImportTestCase extends \PHPUnit\Framework\Te
68
68
*/
69
69
private $ writer ;
70
70
71
+ /**
72
+ * @var string
73
+ */
74
+ private $ csvFile ;
75
+
71
76
/**
72
77
* @inheritdoc
73
78
*/
@@ -87,6 +92,11 @@ protected function setUp(): void
87
92
protected function tearDown (): void
88
93
{
89
94
$ this ->executeFixtures ($ this ->fixtures , true );
95
+
96
+ if ($ this ->csvFile !== null ) {
97
+ $ directoryWrite = $ this ->fileSystem ->getDirectoryWrite (DirectoryList::VAR_DIR );
98
+ $ directoryWrite ->delete ($ this ->csvFile );
99
+ }
90
100
}
91
101
92
102
/**
@@ -101,20 +111,53 @@ protected function tearDown(): void
101
111
* @param string[] $skippedAttributes
102
112
* @return void
103
113
* @dataProvider exportImportDataProvider
114
+ * @throws \Magento\Framework\Exception\NoSuchEntityException
104
115
*/
105
116
public function testImportExport (array $ fixtures , array $ skus , array $ skippedAttributes = []): void
106
117
{
118
+ $ this ->csvFile = null ;
107
119
$ this ->fixtures = $ fixtures ;
108
120
$ this ->executeFixtures ($ fixtures );
109
121
$ this ->modifyData ($ skus );
110
122
$ skippedAttributes = array_merge (self ::$ skippedAttributes , $ skippedAttributes );
111
123
$ csvFile = $ this ->executeExportTest ($ skus , $ skippedAttributes );
112
124
113
125
$ this ->executeImportReplaceTest ($ skus , $ skippedAttributes , false , $ csvFile );
114
- $ this ->executeImportReplaceTest ($ skus , $ skippedAttributes , true , $ csvFile );
115
126
$ this ->executeImportDeleteTest ($ skus , $ csvFile );
116
127
}
117
128
129
+ /**
130
+ * Run import replace with pagination tests.
131
+ *
132
+ * @magentoAppArea adminhtml
133
+ * @magentoDbIsolation disabled
134
+ * @magentoAppIsolation enabled
135
+ *
136
+ * @param array $fixtures
137
+ * @param string[] $skus
138
+ * @param string[] $skippedAttributes
139
+ * @dataProvider importReplaceDataProvider
140
+ * @throws \Magento\Framework\Exception\NoSuchEntityException
141
+ */
142
+ public function testImportReplaceWithPagination (array $ fixtures , array $ skus , array $ skippedAttributes = []): void
143
+ {
144
+ $ this ->fixtures = $ fixtures ;
145
+ $ this ->executeFixtures ($ fixtures );
146
+ $ this ->modifyData ($ skus );
147
+ $ skippedAttributes = array_merge (self ::$ skippedAttributes , $ skippedAttributes );
148
+ $ this ->executeImportReplaceTest ($ skus , $ skippedAttributes , true );
149
+ }
150
+
151
+ /**
152
+ * Data provider for import replaces tests.
153
+ *
154
+ * @return array
155
+ */
156
+ public function importReplaceDataProvider ()
157
+ {
158
+ return $ this ->exportImportDataProvider ();
159
+ }
160
+
118
161
/**
119
162
* Provide data for import/export.
120
163
*
@@ -209,7 +252,7 @@ private function assertEqualsOtherThanSkippedAttributes(
209
252
210
253
$ this ->assertEquals (
211
254
$ value ,
212
- isset ( $ actual [$ key ]) ? $ actual [ $ key ] : null ,
255
+ $ actual [$ key ] ?? null ,
213
256
'Assert value at key - ' . $ key . ' failed '
214
257
);
215
258
}
@@ -378,6 +421,7 @@ protected function executeImportReplaceTest(
378
421
private function exportProducts (\Magento \CatalogImportExport \Model \Export \Product $ exportProduct = null )
379
422
{
380
423
$ csvfile = uniqid ('importexport_ ' ) . '.csv ' ;
424
+ $ this ->csvFile = $ csvfile ;
381
425
382
426
$ exportProduct = $ exportProduct ?: $ this ->objectManager ->create (
383
427
\Magento \CatalogImportExport \Model \Export \Product::class
0 commit comments