protected function setUp() { parent::setUp(); /** @var \PHPUnit_Framework_MockObject_MockObject|RoundingService $roundingService */ $roundingService = $this->getMockBuilder('OroB2B\\Bundle\\ProductBundle\\Rounding\\RoundingService')->disableOriginalConstructor()->getMock(); $roundingService->expects($this->any())->method('round')->willReturnCallback(function ($value, $precision) { return round($value, $precision); }); $this->type = new LineItemType($this->getRegistry(), $roundingService); $this->type->setDataClass(self::DATA_CLASS); $this->type->setProductClass(self::PRODUCT_CLASS); }
protected function setUp() { parent::setUp(); /** @var \PHPUnit_Framework_MockObject_MockObject|LineItemManager $lineItemManager */ $lineItemManager = $this->getMockBuilder('OroB2B\\Bundle\\ShoppingListBundle\\Manager\\LineItemManager')->disableOriginalConstructor()->getMock(); $lineItemManager->expects($this->any())->method('roundProductQuantity')->willReturnCallback(function ($product, $unit, $quantity) { /** @var \PHPUnit_Framework_MockObject_MockObject|Product $product */ return round($quantity, $product->getUnitPrecision($unit)->getPrecision()); }); $this->type = new LineItemType($this->getRegistry(), $lineItemManager); $this->type->setDataClass(self::DATA_CLASS); $this->type->setProductClass(self::PRODUCT_CLASS); $this->type->setLineItemSubscriber($this->getLineItemSubscriber()); }