Example #1
0
 public function testSave()
 {
     $data = ['sample' => ['sampleData', 'link' => ['linkData']]];
     $this->product->expects($this->once())->method('getDownloadableData')->will($this->returnValue($data));
     $this->typeHandler->expects($this->once())->method('save')->with($this->product, $data);
     $this->target->save($this->product);
 }
Example #2
0
 /**
  * Save Product downloadable information (links and samples)
  *
  * @param \Magento\Catalog\Model\Product $product
  * @return $this
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function save($product)
 {
     parent::save($product);
     if ($data = $product->getDownloadableData()) {
         $this->typeHandler->save($product, $data);
     }
     return $this;
 }