Ejemplo n.º 1
0
 public function testGetRegularPrice()
 {
     $priceInfoMock = $this->getMockForAbstractClass('Magento\\Framework\\Pricing\\PriceInfoInterface', [], '', false, false, true, ['getAmount', 'getPrice']);
     $priceInfoMock->expects($this->once())->method('getPrice')->willReturnSelf();
     $amountMock = $this->getMockForAbstractClass('Magento\\Framework\\Pricing\\Amount\\AmountInterface');
     $priceInfoMock->expects($this->once())->method('getAmount')->willReturn($amountMock);
     $this->productMock->expects($this->once())->method('getPriceInfo')->willReturn($priceInfoMock);
     $amountMock->expects($this->once())->method('getValue')->willReturn(50);
     $this->model->setPrice(50);
     $this->model->setPriceType(\Magento\Catalog\Model\Product\Option\Value::TYPE_PERCENT);
     $this->assertEquals(25, $this->model->getRegularPrice());
     $this->model->setPriceType(null);
     $this->assertEquals(50, $this->model->getRegularPrice());
 }