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
73
73
$ expectedSessionMessage = (string )__ ('Message is added to queue, wait to get your file soon. '
74
74
. ' Make sure your cron job is running to export the file ' );
75
75
$ 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 ]];
83
77
$ 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
+ );
89
85
$ this ->dispatch ('backend/admin/export/export ' );
90
86
$ this ->assertSessionMessages ($ this ->containsEqual ($ expectedSessionMessage ));
91
87
$ 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
41
41
private $ queue ;
42
42
43
43
/** @var Csv */
44
- private $ csv ;
44
+ private $ csvReader ;
45
45
46
46
/** @var Write */
47
47
private $ directory ;
@@ -61,7 +61,7 @@ protected function setUp(): void
61
61
$ this ->messageEncoder = $ this ->objectManager ->get (MessageEncoder::class);
62
62
$ this ->consumer = $ this ->objectManager ->get (Consumer::class);
63
63
$ 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);
65
65
}
66
66
67
67
/**
@@ -91,7 +91,7 @@ public function testProcess(): void
91
91
$ this ->consumer ->process ($ decodedMessage );
92
92
$ this ->filePath = 'export/ ' . $ decodedMessage ->getFileName ();
93
93
$ 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 ));
95
95
$ this ->assertCount (2 , $ data );
96
96
$ skuPosition = array_search (ProductInterface::SKU , array_keys ($ data ));
97
97
$ this ->assertNotFalse ($ skuPosition );
Original file line number Diff line number Diff line change 19
19
$ exportInfoFactory = $ objectManager ->get (ExportInfoFactory::class);
20
20
/** @var PublisherInterface $messagePublisher */
21
21
$ 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
- ];
28
22
$ 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
+ [ ]
33
27
);
34
28
$ messagePublisher ->publish ('import_export.export ' , $ dataObject );
You can’t perform that action at this time.
0 commit comments