public function __construct(CartItemOptionValue $cartItemOptionValue, DTOBuilderFactoryInterface $dtoBuilderFactory) { $this->entity = $cartItemOptionValue; $this->dtoBuilderFactory = $dtoBuilderFactory; $this->entityDTO = new CartItemOptionValueDTO(); $this->setId(); $this->setTime(); $this->entityDTO->optionValue = $this->dtoBuilderFactory->getOptionValueDTOBuilder($this->entity->getOptionValue())->withAllData()->build(); }
public function testCreate() { $cartItem = $this->dummyData->getCartItem(); $optionValue = $this->dummyData->getOptionValue(); $optionValue->setSku('MD'); $optionValue->setShippingWeight(6); $cartItemOptionValue = new CartItemOptionValue(); $cartItemOptionValue->setOptionValue($optionValue); $cartItemOptionValue->setCartItem($cartItem); $this->assertSame('MD', $cartItemOptionValue->getSku()); $this->assertSame(6, $cartItemOptionValue->getShippingWeight()); $this->assertTrue($cartItemOptionValue->getPrice() instanceof Price); $this->assertSame($optionValue, $cartItemOptionValue->getOptionValue()); $this->assertSame($cartItem, $cartItemOptionValue->getCartItem()); }