@@ -88,7 +88,7 @@ protected function setUp(): void
8888 }
8989
9090 /**
91- * @dataProvider invoiceDataProvider
91+ * @dataProvider \Magento\Bundle\Test\Unit\Model\Sales\Order\Pdf\Items\InvoiceTestProvider::getData
9292 * @param array $expected
9393 * @param string $method
9494 */
@@ -109,195 +109,6 @@ public function testDrawPrice(array $expected, string $method): void
109109 $ this ->model ->draw ();
110110 }
111111
112- /**
113- * @return array[]
114- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
115- */
116- public function invoiceDataProvider (): array
117- {
118- return [
119- 'display_both ' => [
120- 'expected ' => [
121- 1 => [
122- 'height ' => 15 ,
123- 'lines ' => [
124- [
125- [
126- 'text ' => 'test option ' ,
127- 'feed ' => 35 ,
128- 'font ' => 'italic ' ,
129-
130- ],
131- ],
132- [
133- [
134- 'text ' => 'Simple1 ' ,
135- 'feed ' => 40 ,
136- ],
137- [
138- 'text ' => 2 ,
139- 'feed ' => 435 ,
140- 'align ' => 'right ' ,
141- ],
142- [
143- 'text ' => 1.66 ,
144- 'feed ' => 495 ,
145- 'font ' => 'bold ' ,
146- 'align ' => 'right ' ,
147- ],
148- [
149- 'text ' => 'Excl. Tax: ' ,
150- 'feed ' => 380 ,
151- 'align ' => 'right ' ,
152- ],
153- [
154- 'text ' => 'Excl. Tax: ' ,
155- 'feed ' => 565 ,
156- 'align ' => 'right ' ,
157- ],
158- ],
159- [
160- [
161- 'text ' => '10.00 ' ,
162- 'feed ' => 380 ,
163- 'font ' => 'bold ' ,
164- 'align ' => 'right ' ,
165- ],
166- [
167- 'text ' => '20.00 ' ,
168- 'feed ' => 565 ,
169- 'font ' => 'bold ' ,
170- 'align ' => 'right ' ,
171- ],
172- ],
173- [
174- [
175- 'text ' => 'Incl. Tax: ' ,
176- 'feed ' => 380 ,
177- 'align ' => 'right ' ,
178- ],
179- [
180- 'text ' => 'Incl. Tax: ' ,
181- 'feed ' => 565 ,
182- 'align ' => 'right ' ,
183- ],
184- ],
185- [
186- [
187- 'text ' => '10.83 ' ,
188- 'feed ' => 380 ,
189- 'font ' => 'bold ' ,
190- 'align ' => 'right ' ,
191- ],
192- [
193- 'text ' => '21.66 ' ,
194- 'feed ' => 565 ,
195- 'font ' => 'bold ' ,
196- 'align ' => 'right ' ,
197- ],
198- ],
199- ],
200- ],
201- ],
202- 'tax_mock_method ' => 'displaySalesBothPrices ' ,
203- ],
204- 'including_tax ' => [
205- 'expected ' => [
206- 1 => [
207- 'height ' => 15 ,
208- 'lines ' => [
209- [
210- [
211- 'text ' => 'test option ' ,
212- 'feed ' => 35 ,
213- 'font ' => 'italic ' ,
214-
215- ],
216- ],
217- [
218- [
219- 'text ' => 'Simple1 ' ,
220- 'feed ' => 40 ,
221- ],
222- [
223- 'text ' => 2 ,
224- 'feed ' => 435 ,
225- 'align ' => 'right ' ,
226- ],
227- [
228- 'text ' => 1.66 ,
229- 'feed ' => 495 ,
230- 'font ' => 'bold ' ,
231- 'align ' => 'right ' ,
232- ],
233- [
234- 'text ' => '10.83 ' ,
235- 'feed ' => 380 ,
236- 'font ' => 'bold ' ,
237- 'align ' => 'right ' ,
238- ],
239- [
240- 'text ' => '21.66 ' ,
241- 'feed ' => 565 ,
242- 'font ' => 'bold ' ,
243- 'align ' => 'right ' ,
244- ],
245- ],
246- ],
247- ],
248- ],
249- 'tax_mock_method ' => 'displaySalesPriceInclTax ' ,
250- ],
251- 'excluding_tax ' => [
252- 'expected ' => [
253- 1 => [
254- 'height ' => 15 ,
255- 'lines ' => [
256- [
257- [
258- 'text ' => 'test option ' ,
259- 'feed ' => 35 ,
260- 'font ' => 'italic ' ,
261-
262- ],
263- ],
264- [
265- [
266- 'text ' => 'Simple1 ' ,
267- 'feed ' => 40 ,
268- ],
269- [
270- 'text ' => 2 ,
271- 'feed ' => 435 ,
272- 'align ' => 'right ' ,
273- ],
274- [
275- 'text ' => 1.66 ,
276- 'feed ' => 495 ,
277- 'font ' => 'bold ' ,
278- 'align ' => 'right ' ,
279- ],
280- [
281- 'text ' => '10.00 ' ,
282- 'feed ' => 380 ,
283- 'font ' => 'bold ' ,
284- 'align ' => 'right ' ,
285- ],
286- [
287- 'text ' => '20.00 ' ,
288- 'feed ' => 565 ,
289- 'font ' => 'bold ' ,
290- 'align ' => 'right ' ,
291- ],
292- ],
293- ],
294- ],
295- ],
296- 'tax_mock_method ' => 'displaySalesPriceExclTax ' ,
297- ],
298- ];
299- }
300-
301112 /**
302113 * Prepare invoice draw model for test execution
303114 *
@@ -334,16 +145,37 @@ private function prepareModel(): void
334145 ),
335146 ]
336147 ),
148+ new DataObject (
149+ [
150+ 'name ' => 'Simple2 ' ,
151+ 'sku ' => 'simple2 ' ,
152+ 'price ' => '5.00 ' ,
153+ 'price_incl_tax ' => '5.41 ' ,
154+ 'row_total ' => '10.00 ' ,
155+ 'row_total_incl_tax ' => '10.83 ' ,
156+ 'qty ' => '2 ' ,
157+ 'tax_amount ' => '0.83 ' ,
158+ 'order_item ' => new DataObject (
159+ [
160+ 'parent_item ' => $ parentItem ,
161+ ]
162+ ),
163+ ]
164+ ),
337165 ];
338166 $ orderMock = $ this ->createMock (Order::class);
339167
340168 $ this ->model ->expects ($ this ->any ())->method ('getChildren ' )->willReturn ($ items );
341169 $ this ->model ->expects ($ this ->any ())->method ('isShipmentSeparately ' )->willReturn (false );
342170 $ this ->model ->expects ($ this ->any ())->method ('isChildCalculated ' )->willReturn (true );
343- $ this ->model ->expects ($ this ->any ())->method ('getValueHtml ' )->willReturn ($ items [0 ]->getName ());
344- $ this ->model ->expects ($ this ->any ())->method ('getSelectionAttributes ' )->willReturn (
171+ $ this ->model ->expects ($ this ->at (2 ))->method ('getSelectionAttributes ' )->willReturn (
345172 ['option_id ' => 1 , 'option_label ' => 'test option ' ]
346173 );
174+ $ this ->model ->expects ($ this ->at (3 ))->method ('getValueHtml ' )->willReturn ($ items [0 ]->getName ());
175+ $ this ->model ->expects ($ this ->at (5 ))->method ('getSelectionAttributes ' )->willReturn (
176+ ['option_id ' => 1 , 'option_label ' => 'second option ' ]
177+ );
178+ $ this ->model ->expects ($ this ->at (6 ))->method ('getValueHtml ' )->willReturn ($ items [1 ]->getName ());
347179
348180 $ orderMock ->expects ($ this ->any ())->method ('formatPriceTxt ' )->willReturnArgument (0 );
349181 $ this ->model ->setOrder ($ orderMock );
0 commit comments