2929class AdjustmentTest extends TestCase
3030{
3131 /**
32- * Context mock
33- *
3432 * @var \Magento\Framework\View\Element\Template\Context
3533 */
3634 protected $ contextMock ;
@@ -54,6 +52,11 @@ class AdjustmentTest extends TestCase
5452 */
5553 protected $ model ;
5654
55+ /**
56+ * @var AmountRenderInterface
57+ */
58+ protected $ amountRender ;
59+
5760 /**
5861 * Init mocks and model
5962 */
@@ -350,4 +353,33 @@ public function testGetHtmlBoth()
350353
351354 $ this ->model ->render ($ amountRender , $ arguments );
352355 }
356+
357+ /**
358+ * test for method getDataPriceType
359+ * @dataProvider dataPriceTypeDataProvider
360+ */
361+ public function testGetDataPriceType (?string $ priceType , string $ priceTypeValue ): void
362+ {
363+ $ amountRender = $ this ->getMockBuilder (Amount::class)
364+ ->addMethods (['getPriceType ' ])
365+ ->disableOriginalConstructor ()
366+ ->getMock ();
367+ $ amountRender ->expects ($ this ->atLeastOnce ())
368+ ->method ('getPriceType ' )
369+ ->willReturn ($ priceType );
370+ $ this ->model ->render ($ amountRender , []);
371+ //no exception is thrown
372+ $ this ->assertEquals ($ priceTypeValue , $ this ->model ->getDataPriceType ());
373+ $ this ->assertIsString ($ this ->model ->getDataPriceType ());
374+ }
375+
376+ /**
377+ * data provider for testGetDataPriceType
378+ *
379+ * @return array
380+ */
381+ public function dataPriceTypeDataProvider (): array
382+ {
383+ return [['finalPrice ' , 'basePrice ' ], [null , '' ]];
384+ }
353385}
0 commit comments