12 class CostTest extends \PHPUnit\Framework\TestCase
31 $this->creditmemoMock = $this->createPartialMock(
33 [
'setBaseCost',
'getAllItems']
35 $this->creditmemoItemMock = $this->createPartialMock(
37 [
'getHasChildren',
'getBaseCost',
'getQty']
39 $this->total = new \Magento\Sales\Model\Order\Creditmemo\Total\Cost();
44 $this->creditmemoMock->expects($this->once())
45 ->method(
'getAllItems')
46 ->willReturn([$this->creditmemoItemMock, $this->creditmemoItemMock]);
47 $this->creditmemoItemMock->expects($this->exactly(2))
48 ->method(
'getHasChildren')
50 $this->creditmemoItemMock->expects($this->exactly(2))
51 ->method(
'getBaseCost')
53 $this->creditmemoItemMock->expects($this->exactly(2))
56 $this->creditmemoMock->expects($this->once())
57 ->method(
'setBaseCost')
60 $this->assertEquals($this->total, $this->total->collect($this->creditmemoMock));