File tree Expand file tree Collapse file tree 3 files changed +15
-25
lines changed
dev/tests/integration/testsuite/Magento/ImportExport
Controller/Adminhtml/Export Expand file tree Collapse file tree 3 files changed +15
-25
lines changed Original file line number Diff line number Diff line change @@ -73,19 +73,15 @@ public function testExecute(): void
7373 $ expectedSessionMessage = (string )__ ('Message is added to queue, wait to get your file soon. '
7474 . ' Make sure your cron job is running to export the file ' );
7575 $ fileFormat = 'csv ' ;
76- $ filter = ['price ' => [0 ,1000 ]];
77- $ this ->getRequest ()->setParams (
78- [
79- 'entity ' => ProductAttributeInterface::ENTITY_TYPE_CODE ,
80- 'file_format ' => $ fileFormat ,
81- ]
82- );
76+ $ filter = ['price ' => [0 , 1000 ]];
8377 $ this ->getRequest ()->setMethod (Http::METHOD_POST )
84- ->setPostValue ([
85- 'export_filter ' => [
86- $ filter ,
87- ],
88- ]);
78+ ->setPostValue (['export_filter ' => [$ filter ]])
79+ ->setParams (
80+ [
81+ 'entity ' => ProductAttributeInterface::ENTITY_TYPE_CODE ,
82+ 'file_format ' => $ fileFormat ,
83+ ]
84+ );
8985 $ this ->dispatch ('backend/admin/export/export ' );
9086 $ this ->assertSessionMessages ($ this ->containsEqual ($ expectedSessionMessage ));
9187 $ this ->assertRedirect ($ this ->stringContains ('/export/index/key/ ' ));
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ class ConsumerTest extends TestCase
4141 private $ queue ;
4242
4343 /** @var Csv */
44- private $ csv ;
44+ private $ csvReader ;
4545
4646 /** @var Write */
4747 private $ directory ;
@@ -61,7 +61,7 @@ protected function setUp(): void
6161 $ this ->messageEncoder = $ this ->objectManager ->get (MessageEncoder::class);
6262 $ this ->consumer = $ this ->objectManager ->get (Consumer::class);
6363 $ this ->directory = $ this ->objectManager ->get (Filesystem::class)->getDirectoryWrite (DirectoryList::VAR_DIR );
64- $ this ->csv = $ this ->objectManager ->get (Csv::class);
64+ $ this ->csvReader = $ this ->objectManager ->get (Csv::class);
6565 }
6666
6767 /**
@@ -91,7 +91,7 @@ public function testProcess(): void
9191 $ this ->consumer ->process ($ decodedMessage );
9292 $ this ->filePath = 'export/ ' . $ decodedMessage ->getFileName ();
9393 $ this ->assertTrue ($ this ->directory ->isExist ($ this ->filePath ));
94- $ data = $ this ->csv ->getData ($ this ->directory ->getAbsolutePath ($ this ->filePath ));
94+ $ data = $ this ->csvReader ->getData ($ this ->directory ->getAbsolutePath ($ this ->filePath ));
9595 $ this ->assertCount (2 , $ data );
9696 $ skuPosition = array_search (ProductInterface::SKU , array_keys ($ data ));
9797 $ this ->assertNotFalse ($ skuPosition );
Original file line number Diff line number Diff line change 1919$ exportInfoFactory = $ objectManager ->get (ExportInfoFactory::class);
2020/** @var PublisherInterface $messagePublisher */
2121$ messagePublisher = $ objectManager ->get (PublisherInterface::class);
22- $ params = [
23- 'file_format ' => 'csv ' ,
24- 'entity ' => ProductAttributeInterface::ENTITY_TYPE_CODE ,
25- 'export_filter ' => [ProductInterface::SKU => 'simple2 ' ],
26- 'skip_attr ' => [],
27- ];
2822$ dataObject = $ exportInfoFactory ->create (
29- $ params [ ' file_format ' ] ,
30- $ params [ ' entity ' ] ,
31- $ params [ ' export_filter ' ],
32- $ params [ ' skip_attr ' ]
23+ ' csv ' ,
24+ ProductAttributeInterface:: ENTITY_TYPE_CODE ,
25+ [ProductInterface:: SKU => ' simple2 ' ],
26+ [ ]
3327);
3428$ messagePublisher ->publish ('import_export.export ' , $ dataObject );
You can’t perform that action at this time.
0 commit comments