Skip to content

Commit 28e8e5a

Browse files
author
a.chorniy
committed
Issue-25968 - Added adjustments after review
1 parent 0b7a99d commit 28e8e5a

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

app/code/Magento/Sales/Model/Order/Item.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,8 @@ public function getStatus()
385385
*
386386
* @param string $statusId
387387
* @return \Magento\Framework\Phrase
388+
*
389+
* phpcs:disable Magento2.Functions.StaticFunction
388390
*/
389391
public static function getStatusName($statusId)
390392
{
@@ -422,6 +424,8 @@ public function cancel()
422424
* Retrieve order item statuses array
423425
*
424426
* @return array
427+
*
428+
* phpcs:disable Magento2.Functions.StaticFunction
425429
*/
426430
public static function getStatuses()
427431
{

app/code/Magento/Sales/Test/Unit/Model/Order/ItemTest.php

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99
use Magento\Framework\Serialize\Serializer\Json;
1010
use Magento\Sales\Model\ResourceModel\OrderFactory;
1111
use \Magento\Sales\Model\Order;
12+
use Magento\Sales\Api\Data\OrderItemInterface;
1213

1314
/**
14-
* Class ItemTest
15-
*
16-
* @package Magento\Sales\Model\Order
15+
* Unit test for order item class.
1716
*/
1817
class ItemTest extends \PHPUnit\Framework\TestCase
1918
{
@@ -72,7 +71,7 @@ public function testSetParentItem()
7271
public function testGetPatentItem()
7372
{
7473
$item = $this->objectManager->getObject(\Magento\Sales\Model\Order\Item::class, []);
75-
$this->model->setData(\Magento\Sales\Api\Data\OrderItemInterface::PARENT_ITEM, $item);
74+
$this->model->setData(OrderItemInterface::PARENT_ITEM, $item);
7675
$this->assertEquals($item, $this->model->getParentItem());
7776
}
7877

@@ -184,7 +183,7 @@ public function testGetOriginalPrice()
184183
$this->assertEquals($price, $this->model->getOriginalPrice());
185184

186185
$originalPrice = 5.55;
187-
$this->model->setData(\Magento\Sales\Api\Data\OrderItemInterface::ORIGINAL_PRICE, $originalPrice);
186+
$this->model->setData(OrderItemInterface::ORIGINAL_PRICE, $originalPrice);
188187
$this->assertEquals($originalPrice, $this->model->getOriginalPrice());
189188
}
190189

@@ -350,20 +349,23 @@ public function getItemQtyVariants()
350349
}
351350

352351
/**
353-
* Test getPrice() method
352+
* Test getPrice() method should returns float
354353
*/
355-
public function testGetPrice()
354+
public function testGetPriceReturnsFloat()
356355
{
357356
$price = 9.99;
358357
$this->model->setPrice($price);
359358
$this->assertEquals($price, $this->model->getPrice());
359+
}
360360

361-
$newPrice = 5.53;
362-
$this->model->setData(\Magento\Sales\Api\Data\OrderItemInterface::PRICE, $newPrice);
363-
$this->assertEquals($newPrice, $this->model->getPrice());
364-
361+
/**
362+
* Test getPrice() method should returns null
363+
*/
364+
public function testGetPriceReturnsNull()
365+
{
365366
$nullablePrice = null;
366-
$this->model->setPrice($nullablePrice);
367+
$this->model->setData(OrderItemInterface::PRICE, $nullablePrice);
367368
$this->assertEquals($nullablePrice, $this->model->getPrice());
368369
}
370+
369371
}

0 commit comments

Comments
 (0)