public function __construct(Product $product, DTOBuilderFactoryInterface $dtoBuilderFactory) { $this->entity = $product; $this->dtoBuilderFactory = $dtoBuilderFactory; $this->initializeProductDTO(); $this->setId(); $this->setTime(); $this->entityDTO->slug = Slug::get($this->entity->getName()); $this->entityDTO->sku = $this->entity->getSku(); $this->entityDTO->name = $this->entity->getName(); $this->entityDTO->unitPrice = $this->entity->getUnitPrice(); $this->entityDTO->quantity = $this->entity->getQuantity(); $this->entityDTO->isInventoryRequired = $this->entity->isInventoryRequired(); $this->entityDTO->isPriceVisible = $this->entity->isPriceVisible(); $this->entityDTO->isVisible = $this->entity->isVisible(); $this->entityDTO->isActive = $this->entity->isActive(); $this->entityDTO->isTaxable = $this->entity->isTaxable(); $this->entityDTO->isShippable = $this->entity->isShippable(); $this->entityDTO->shippingWeight = $this->entity->getShippingWeight(); $this->entityDTO->description = $this->entity->getDescription(); $this->entityDTO->rating = $this->entity->getRating(); $this->entityDTO->defaultImage = $this->entity->getDefaultImage(); $this->entityDTO->isInStock = $this->entity->inStock(); $this->entityDTO->areAttachmentsEnabled = $this->entity->areAttachmentsEnabled(); }
public function testInStockReturnsFalseWhenLackingQuantity() { $product = new Product(); $product->setIsInventoryRequired(true); $product->setQuantity(0); $this->assertFalse($product->inStock()); }