/** * @param $typeId * @param $quantity * @param $infoClass * @param $prices * @dataProvider createPriceInfoDataProvider */ public function testCreate($typeId, $quantity, $infoClass, $prices) { $this->saleableItemMock->expects($this->once())->method('getTypeId')->will($this->returnValue($typeId)); $this->saleableItemMock->expects($this->once())->method('getQty')->will($this->returnValue($quantity)); $this->objectManagerMock->expects($this->exactly(2))->method('create')->will($this->returnValueMap([[$prices, ['saleableItem' => $this->saleableItemMock, 'quantity' => $quantity], $this->pricesMock], [$infoClass, ['saleableItem' => $this->saleableItemMock, 'quantity' => $quantity, 'prices' => $this->pricesMock], $this->priceInfoMock]])); $this->assertEquals($this->priceInfoMock, $this->factory->create($this->saleableItemMock, [])); }
/** * Get Product Price Info object * * @param Product $saleableItem * @return \Magento\Framework\Pricing\PriceInfoInterface */ public function getPriceInfo(Product $saleableItem) { return $this->_priceInfoFactory->create($saleableItem); }