![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/module-sales/Test/Unit/Model/Order/Admin/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); namespace Magento\Sales\Test\Unit\Model\Order\Admin; use Magento\Sales\Model\Order\Admin\Item; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class ItemTest extends TestCase { /** * @var MockObject */ protected $orderItemMock; /** @var Item */ protected $item; protected function setUp(): void { $this->orderItemMock = $this->getMockBuilder(\Magento\Sales\Model\Order\Item::class) ->disableOriginalConstructor() ->getMock(); $this->item = new Item(); } public function testGetSku() { $sku = 'sku'; $this->orderItemMock->expects($this->once()) ->method('getSku') ->willReturn($sku); $result = $this->item->getSku($this->orderItemMock); $this->assertEquals($sku, $result); } public function testGetName() { $name = 'name'; $this->orderItemMock->expects($this->once()) ->method('getName') ->willReturn($name); $result = $this->item->getName($this->orderItemMock); $this->assertEquals($name, $result); } public function testGetProductId() { $productId = 1; $this->orderItemMock->expects($this->once()) ->method('getProductId') ->willReturn($productId); $result = $this->item->getProductId($this->orderItemMock); $this->assertEquals($productId, $result); } }