File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -1319,7 +1319,13 @@ public function getParentItemId()
1319
1319
*/
1320
1320
public function getPrice ()
1321
1321
{
1322
- return $ this ->getData (OrderItemInterface::PRICE );
1322
+ $ price = $ this ->getData (OrderItemInterface::PRICE );
1323
+
1324
+ if ($ price === null ) {
1325
+ return $ price ;
1326
+ }
1327
+
1328
+ return (float ) $ price ;
1323
1329
}
1324
1330
1325
1331
/**
Original file line number Diff line number Diff line change @@ -348,4 +348,22 @@ public function getItemQtyVariants()
348
348
]
349
349
];
350
350
}
351
+
352
+ /**
353
+ * Test getPrice() method
354
+ */
355
+ public function testGetPrice ()
356
+ {
357
+ $ price = 9.99 ;
358
+ $ this ->model ->setPrice ($ price );
359
+ $ this ->assertEquals ($ price , $ this ->model ->getPrice ());
360
+
361
+ $ newPrice = 5.53 ;
362
+ $ this ->model ->setData (\Magento \Sales \Api \Data \OrderItemInterface::PRICE , $ newPrice );
363
+ $ this ->assertEquals ($ newPrice , $ this ->model ->getPrice ());
364
+
365
+ $ nullablePrice = null ;
366
+ $ this ->model ->setPrice ($ nullablePrice );
367
+ $ this ->assertEquals ($ nullablePrice , $ this ->model ->getPrice ());
368
+ }
351
369
}
You can’t perform that action at this time.
0 commit comments