35 \
Magento\Backend\Model\Session::class,
36 [
'hasCompositeProductResult',
'getCompositeProductResult',
'unsCompositeProductResult']
39 ->method(
'hasCompositeProductResult')
42 ->method(
'unsCompositeProductResult');
43 $session->expects($this->atLeastOnce())
44 ->method(
'getCompositeProductResult')
57 $productActionMock = $this->createMock(\
Magento\Catalog\Model\
Product\Action::class);
58 $objectManagerMock = $this->getMockForAbstractClass(\
Magento\Framework\ObjectManagerInterface::class);
59 $objectManagerMock->expects($this->any())
61 ->willReturn($productActionMock);
63 $eventManager = $this->getMockBuilder(\
Magento\Framework\Event\Manager::class)
64 ->setMethods([
'dispatch'])
65 ->disableOriginalConstructor()
66 ->getMockForAbstractClass();
68 $eventManager->expects($this->any())
72 $this->request = $this->createPartialMock(
74 [
'getParam',
'getPost',
'getFullActionName',
'getPostValue']
77 $responseInterfaceMock = $this->createPartialMock(
78 \
Magento\Framework\
App\ResponseInterface::class,
79 [
'setRedirect',
'sendResponse']
82 $managerInterfaceMock = $this->createMock(\
Magento\Framework\Message\ManagerInterface::class);
84 $actionFlagMock = $this->createMock(\
Magento\Framework\
App\ActionFlag::class);
85 $helperDataMock = $this->createMock(\
Magento\Backend\
Helper\Data::class);
86 $this->context = $this->createPartialMock(\
Magento\Backend\
App\
Action\Context::class, [
97 'getResultRedirectFactory' 100 $this->context->expects($this->any())
101 ->method(
'getEventManager')
102 ->willReturn($eventManager);
103 $this->context->expects($this->any())
104 ->method(
'getRequest')
105 ->willReturn($this->request);
106 $this->context->expects($this->any())
107 ->method(
'getResponse')
108 ->willReturn($responseInterfaceMock);
109 $this->context->expects($this->any())
110 ->method(
'getObjectManager')
111 ->willReturn($objectManagerMock);
113 $this->context->expects($this->any())
114 ->method(
'getMessageManager')
115 ->willReturn($managerInterfaceMock);
116 $this->context->expects($this->any())
117 ->method(
'getSession')
118 ->willReturn($this->session);
119 $this->context->expects($this->any())
120 ->method(
'getActionFlag')
121 ->willReturn($actionFlagMock);
122 $this->context->expects($this->any())
123 ->method(
'getHelper')
124 ->willReturn($helperDataMock);
129 public function testExecute()
132 $productCompositeHelper->expects($this->once())
133 ->method(
'renderUpdateResult');
135 $productBuilder = $this->createMock(\
Magento\Catalog\Controller\Adminhtml\
Product\Builder::class);