19
19
20
20
/**
21
21
* Advanced pricing test
22
+ *
23
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
22
24
*/
23
25
class AdvancedPricingTest extends TestCase
24
26
{
25
27
/**
26
- * @var \Magento\AdvancedPricingImportExport\Model\Export\AdvancedPricing
28
+ * @var ExportAdvancedPricing
27
29
*/
28
- protected $ model ;
30
+ private $ model ;
29
31
30
32
/**
31
33
* @var \Magento\Framework\ObjectManagerInterface
32
34
*/
33
- protected $ objectManager ;
35
+ private $ objectManager ;
34
36
35
37
/**
36
- * @var \Magento\Framework\ Filesystem
38
+ * @var Filesystem
37
39
*/
38
- protected $ fileSystem ;
40
+ private $ fileSystem ;
39
41
40
42
// @codingStandardsIgnoreStart
41
43
public static function setUpBeforeClass ()
@@ -53,6 +55,9 @@ public static function setUpBeforeClass()
53
55
}
54
56
// @codingStandardsIgnoreEnd
55
57
58
+ /**
59
+ * @inheritdoc
60
+ */
56
61
protected function setUp ()
57
62
{
58
63
parent ::setUp ();
@@ -63,12 +68,15 @@ protected function setUp()
63
68
}
64
69
65
70
/**
71
+ * Export test
72
+ *
66
73
* @magentoAppArea adminhtml
67
74
* @magentoDbIsolation disabled
68
75
* @magentoAppIsolation enabled
69
76
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
77
+ * @return void
70
78
*/
71
- public function testExport ()
79
+ public function testExport (): void
72
80
{
73
81
$ productRepository = $ this ->objectManager ->create (ProductRepositoryInterface::class);
74
82
$ index = 0 ;
@@ -107,7 +115,7 @@ public function testExport()
107
115
* @param string $exportContent
108
116
* @return void
109
117
*/
110
- private function assertDiscountTypes ($ exportContent )
118
+ private function assertDiscountTypes (string $ exportContent ): void
111
119
{
112
120
$ this ->assertContains (
113
121
'2.0000,8.000000,Fixed ' ,
@@ -120,13 +128,16 @@ private function assertDiscountTypes($exportContent)
120
128
}
121
129
122
130
/**
131
+ * Export multiple websites test
132
+ *
123
133
* @magentoAppArea adminhtml
124
134
* @magentoDbIsolation disabled
125
135
* @magentoAppIsolation enabled
126
136
* @magentoConfigFixture current_store catalog/price/scope 1
127
137
* @magentoDataFixture Magento/AdvancedPricingImportExport/_files/product_with_second_website.php
138
+ * @return void
128
139
*/
129
- public function testExportMultipleWebsites ()
140
+ public function testExportMultipleWebsites (): void
130
141
{
131
142
$ productRepository = $ this ->objectManager ->create (ProductRepositoryInterface::class);
132
143
$ index = 0 ;
@@ -162,17 +173,18 @@ public function testExportMultipleWebsites()
162
173
}
163
174
164
175
/**
176
+ * Data export
177
+ *
165
178
* @param string $csvFile
166
179
* @return string
167
180
*/
168
- private function exportData ($ csvFile )
181
+ private function exportData (string $ csvFile ): string
169
182
{
170
183
$ this ->model ->setWriter (
171
- Bootstrap::getObjectManager ()
172
- ->create (
173
- ExportAdapterCsv::class,
174
- ['fileSystem ' => $ this ->fileSystem , 'destination ' => $ csvFile ]
175
- )
184
+ $ this ->objectManager ->create (
185
+ ExportAdapterCsv::class,
186
+ ['fileSystem ' => $ this ->fileSystem , 'destination ' => $ csvFile ]
187
+ )
176
188
);
177
189
$ exportContent = $ this ->model ->export ();
178
190
$ this ->assertNotEmpty ($ exportContent );
@@ -181,9 +193,12 @@ private function exportData($csvFile)
181
193
}
182
194
183
195
/**
196
+ * Data import
197
+ *
184
198
* @param string $csvFile
199
+ * @return void
185
200
*/
186
- private function importData ($ csvFile )
201
+ private function importData (string $ csvFile ): void
187
202
{
188
203
/** @var ImportAdvancedPricing $importModel */
189
204
$ importModel = $ this ->objectManager ->create (ImportAdvancedPricing::class);
@@ -211,8 +226,19 @@ private function importData($csvFile)
211
226
$ importModel ->importData ();
212
227
}
213
228
214
- private function assertEqualsOtherThanSkippedAttributes ($ expected , $ actual , $ skippedAttributes )
215
- {
229
+ /**
230
+ * Assert equals other than skipped attributes
231
+ *
232
+ * @param array $expected
233
+ * @param array $actual
234
+ * @param array $skippedAttributes
235
+ * @return void
236
+ */
237
+ private function assertEqualsOtherThanSkippedAttributes (
238
+ array $ expected ,
239
+ array $ actual ,
240
+ array $ skippedAttributes
241
+ ): void {
216
242
foreach ($ expected as $ key => $ value ) {
217
243
if (in_array ($ key , $ skippedAttributes )) {
218
244
continue ;
0 commit comments