Example #1
0
 public function testSetProduct()
 {
     $product = $this->getMock('Magento\\Catalog\\Model\\Product', ['getId', 'getName', 'getStoreId', 'getTypeId', 'dataHasChangedFor', 'getIsChangedWebsites', '__wakeup'], [], '', false);
     $productId = 2;
     $productName = 'Some Name';
     $storeId = 3;
     $typeId = 'simple';
     $status = 1;
     $isChangedWebsites = false;
     $product->expects($this->once())->method('getId')->will($this->returnValue($productId));
     $product->expects($this->once())->method('getName')->will($this->returnValue($productName));
     $product->expects($this->once())->method('getStoreId')->will($this->returnValue($storeId));
     $product->expects($this->once())->method('getTypeId')->will($this->returnValue($typeId));
     $product->expects($this->once())->method('dataHasChangedFor')->with($this->equalTo('status'))->will($this->returnValue($status));
     $product->expects($this->once())->method('getIsChangedWebsites')->will($this->returnValue($isChangedWebsites));
     $this->assertSame($this->item, $this->item->setProduct($product));
     $this->assertSame(['product_id' => 2, 'product_type_id' => 'simple', 'product_name' => 'Some Name', 'product_status_changed' => 1, 'product_changed_websites' => false], $this->item->getData());
 }