@@ -152,18 +152,19 @@ public function testConfigurableImport($pathToFile, $productName, $optionSkuList
152
152
}
153
153
154
154
/**
155
+ * @magentoDataFixture Magento/Catalog/_files/enable_reindex_schedule.php
155
156
* @magentoDataFixture Magento/Store/_files/second_store.php
156
157
* @magentoDataFixture Magento/ConfigurableProduct/_files/configurable_attribute.php
157
158
* @magentoAppArea adminhtml
158
159
* @magentoAppIsolation enabled
159
- * @return void
160
+ * @magentoDbIsolation disabled
160
161
*/
161
162
public function testConfigurableImportWithMultipleStores ()
162
163
{
163
164
$ productSku = 'Configurable 1 ' ;
164
165
$ products = [
165
166
'default ' => 'Configurable 1 ' ,
166
- 'fixture_second_store ' => 'Configurable 1 Second Store ' ,
167
+ 'fixture_second_store ' => 'Configurable 1 Second Store '
167
168
];
168
169
$ filesystem = $ this ->objectManager ->create (
169
170
\Magento \Framework \Filesystem::class
@@ -174,24 +175,26 @@ public function testConfigurableImportWithMultipleStores()
174
175
\Magento \ImportExport \Model \Import \Source \Csv::class,
175
176
[
176
177
'file ' => __DIR__ . '/../../_files/import_configurable_for_multiple_store_views.csv ' ,
177
- 'directory ' => $ directory,
178
+ 'directory ' => $ directory
178
179
]
179
180
);
180
- $ errors = $ this ->model ->setSource ($ source )->setParameters (
181
+ $ errors = $ this ->model ->setSource (
182
+ $ source
183
+ )->setParameters (
181
184
[
182
185
'behavior ' => \Magento \ImportExport \Model \Import::BEHAVIOR_APPEND ,
183
- 'entity ' => 'catalog_product ' ,
186
+ 'entity ' => 'catalog_product '
184
187
]
185
188
)->validateData ();
186
189
187
- $ this ->assertTrue ($ errors ->getErrorsCount () === 0 );
190
+ $ this ->assertTrue ($ errors ->getErrorsCount () == 0 );
188
191
$ this ->model ->importData ();
189
192
190
193
foreach ($ products as $ storeCode => $ productName ) {
191
194
$ store = $ this ->objectManager ->create (\Magento \Store \Model \Store::class);
192
195
$ store ->load ($ storeCode , 'code ' );
193
- /** @var ProductRepositoryInterface $productRepository */
194
- $ productRepository = $ this ->objectManager ->get (ProductRepositoryInterface::class);
196
+ /** @var \Magento\Catalog\Api\ ProductRepositoryInterface $productRepository */
197
+ $ productRepository = $ this ->objectManager ->get (\ Magento \ Catalog \ Api \ ProductRepositoryInterface::class);
195
198
/** @var \Magento\Catalog\Api\Data\ProductInterface $product */
196
199
$ product = $ productRepository ->get ($ productSku , 0 , $ store ->getId ());
197
200
$ this ->assertFalse ($ product ->isObjectNew ());
@@ -201,36 +204,40 @@ public function testConfigurableImportWithMultipleStores()
201
204
}
202
205
203
206
/**
207
+ * @magentoDataFixture Magento/Catalog/_files/enable_reindex_schedule.php
204
208
* @magentoDataFixture Magento/Store/_files/second_store.php
205
209
* @magentoDataFixture Magento/ConfigurableProduct/_files/configurable_attribute.php
206
210
* @magentoDbIsolation disabled
207
211
* @magentoAppArea adminhtml
208
- * @return void
209
212
*/
210
213
public function testConfigurableImportWithStoreSpecifiedMainItem ()
211
214
{
212
- $ expectedErrorMessage = 'Product with assigned super attributes should not have specified "store_view_code" '
213
- . ' value ' ;
214
- $ filesystem = $ this ->objectManager ->create (
215
- \Magento \Framework \Filesystem::class
216
- );
217
-
218
- $ directory = $ filesystem ->getDirectoryWrite (DirectoryList::ROOT );
219
- $ source = $ this ->objectManager ->create (
220
- \Magento \ImportExport \Model \Import \Source \Csv::class,
221
- [
222
- 'file ' => __DIR__ . '/../../_files/import_configurable_for_multiple_store_views_error.csv ' ,
223
- 'directory ' => $ directory ,
224
- ]
225
- );
226
- $ errors = $ this ->model ->setSource ($ source )->setParameters (
227
- [
228
- 'behavior ' => \Magento \ImportExport \Model \Import::BEHAVIOR_APPEND ,
229
- 'entity ' => 'catalog_product ' ,
230
- ]
231
- )->validateData ();
232
-
233
- $ this ->assertTrue ($ errors ->getErrorsCount () === 1 );
234
- $ this ->assertEquals ($ expectedErrorMessage , $ errors ->getAllErrors ()[0 ]->getErrorMessage ());
215
+ {
216
+ $ expectedErrorMessage = 'Product with assigned super attributes should not have specified "store_view_code" '
217
+ . ' value ' ;
218
+ $ filesystem = $ this ->objectManager ->create (
219
+ \Magento \Framework \Filesystem::class
220
+ );
221
+
222
+ $ directory = $ filesystem ->getDirectoryWrite (DirectoryList::ROOT );
223
+ $ source = $ this ->objectManager ->create (
224
+ \Magento \ImportExport \Model \Import \Source \Csv::class,
225
+ [
226
+ 'file ' => __DIR__ . '/../../_files/import_configurable_for_multiple_store_views_error.csv ' ,
227
+ 'directory ' => $ directory
228
+ ]
229
+ );
230
+ $ errors = $ this ->model ->setSource (
231
+ $ source
232
+ )->setParameters (
233
+ [
234
+ 'behavior ' => \Magento \ImportExport \Model \Import::BEHAVIOR_APPEND ,
235
+ 'entity ' => 'catalog_product '
236
+ ]
237
+ )->validateData ();
238
+
239
+ $ this ->assertTrue ($ errors ->getErrorsCount () == 1 );
240
+ $ this ->assertEquals ($ expectedErrorMessage , $ errors ->getAllErrors ()[0 ]->getErrorMessage ());
241
+ }
235
242
}
236
243
}
0 commit comments