public function testCreate()
 {
     $pricing = $this->dummyData->getPricing();
     $option = $this->dummyData->getOption();
     $product = $this->dummyData->getProduct();
     $product->setSku('SM');
     $product->setName('Small Shirt');
     $optionProduct = new OptionProduct($option, $product);
     $optionProduct->setSortOrder(0);
     $this->assertEntityValid($optionProduct);
     $this->assertSame('SM', $optionProduct->getSku());
     $this->assertSame('Small Shirt', $optionProduct->getName());
     $this->assertSame(16, $optionProduct->getShippingWeight());
     $this->assertSame(0, $optionProduct->getSortOrder());
     $this->assertSame($option, $optionProduct->getOption());
     $this->assertSame($product, $optionProduct->getProduct());
     $this->assertTrue($optionProduct->getPrice($pricing) instanceof Price);
 }
Exemple #2
0
 public function getOptionProduct(Option $option = null, Product $product = null)
 {
     if ($option === null) {
         $option = $this->getOption();
     }
     if ($product === null) {
         $product = $this->getProduct();
     }
     $optionProduct = new OptionProduct($option, $product);
     $optionProduct->setSortOrder(0);
     return $optionProduct;
 }
 public static function setFromDTO(OptionProduct &$optionProduct, OptionProductDTO $optionProductDTO)
 {
     $optionProduct->setSortOrder($optionProductDTO->sortOrder);
 }