Example #1
0
 public function testPopupActionWithProductIdNoSetId()
 {
     $storeId = 12;
     $typeId = 4;
     $setId = 0;
     $productId = 399;
     $product = $this->getMock('Magento\\Catalog\\Model\\Product', ['setStoreId', 'setTypeId', 'setData', 'load', '__wakeup'], [], '', false);
     $this->request->expects($this->at(0))->method('getParam')->with('id')->will($this->returnValue($productId));
     $this->factory->expects($this->once())->method('create')->will($this->returnValue($product));
     $this->request->expects($this->at(1))->method('getParam')->with('store', 0)->will($this->returnValue($storeId));
     $product->expects($this->once())->method('setStoreId')->with($storeId);
     $this->request->expects($this->at(2))->method('getParam')->with('type')->will($this->returnValue($typeId));
     $product->expects($this->never())->method('setTypeId');
     $product->expects($this->once())->method('setData')->with('_edit_mode', true);
     $product->expects($this->once())->method('load')->with($productId);
     $this->request->expects($this->at(3))->method('getParam')->with('set')->will($this->returnValue($setId));
     $this->registry->expects($this->once())->method('register')->with('current_product', $product);
     $this->assertSame($this->resultLayoutMock, $this->action->executeInternal());
 }