public function testCreate() { $option = $this->dummyData->getOption(); $optionValue = new OptionValue($option); $optionValue->setSortOrder(2); $optionValue->setSku('MD'); $optionValue->setName('Medium Shirt'); $optionValue->setShippingWeight(16); $optionValue->setUnitPrice(500); $this->assertEntityValid($optionValue); $this->assertSame('MD', $optionValue->getSku()); $this->assertSame('Medium Shirt', $optionValue->getName()); $this->assertSame(16, $optionValue->getShippingWeight()); $this->assertSame(2, $optionValue->getSortOrder()); $this->assertSame($option, $optionValue->getOption()); $this->assertTrue($optionValue->getPrice() instanceof Price); }
public function getOptionValue(Option $option = null) { if ($option === null) { $option = $this->getOption(); } $optionValue = new OptionValue($option); $optionValue->setName('Option Value Name'); $optionValue->setSku('OV-SKU'); $optionValue->setShippingWeight(16); $optionValue->setSortOrder(0); $optionValue->setUnitPrice(100); return $optionValue; }
/** * @return static */ public function withPrice() { $this->entityDTO->price = $this->dtoBuilderFactory->getPriceDTOBuilder($this->entity->getPrice())->build(); return $this; }