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()); }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->type = new FrontendLineItemWidgetType($this->getRegistry(), $this->getTokenStorage()); $this->type->setShoppingListClass(self::SHOPPING_LIST_CLASS); }