86 $this->contextMock = $this->getMockBuilder(Context::class)
87 ->disableOriginalConstructor()
89 $this->resultFactoryMock = $this->getMockBuilder(ResultFactory::class)
90 ->disableOriginalConstructor()
92 $this->layoutMock = $this->getMockBuilder(LayoutInterface::class)
93 ->disableOriginalConstructor()
95 $this->requestMock = $this->getMockBuilder(RequestInterface::class)
96 ->getMockForAbstractClass();
97 $this->productBuilderMock = $this->getMockBuilder(Builder::class)
98 ->disableOriginalConstructor()
100 $this->resultMock = $this->getMockBuilder(ResultInterface::class)
101 ->setMethods([
'forward',
'setJsonData',
'getLayout'])
102 ->getMockForAbstractClass();
103 $this->productMock = $this->getMockBuilder(ProductInterface::class)
104 ->getMockForAbstractClass();
105 $this->uiComponentMock = $this->getMockBuilder(UiComponent::class)
106 ->disableOriginalConstructor()
108 $this->processorMock = $this->getMockBuilder(ProcessorInterface::class)
109 ->getMockForAbstractClass();
111 $this->contextMock->expects($this->any())
112 ->method(
'getRequest')
113 ->willReturn($this->requestMock);
114 $this->resultFactoryMock->expects($this->any())
116 ->willReturn($this->resultMock);
117 $this->contextMock->expects($this->any())
118 ->method(
'getResultFactory')
119 ->willReturn($this->resultFactoryMock);
120 $this->productBuilderMock->expects($this->any())
122 ->willReturn($this->productMock);
123 $this->layoutMock->expects($this->any())
125 ->willReturn($this->uiComponentMock);
126 $this->layoutMock->expects($this->any())
127 ->method(
'getUpdate')
128 ->willReturn($this->processorMock);
129 $this->resultMock->expects($this->any())
130 ->method(
'getLayout')
131 ->willReturn($this->layoutMock);
133 $this->model = $this->objectManager->getObject(Reload::class, [
134 'context' => $this->contextMock,
135 'productBuilder' => $this->productBuilderMock,
136 'layout' => $this->layoutMock,
142 $this->requestMock->expects($this->once())
145 $this->resultMock->expects($this->once())
150 $this->assertSame(
true, $this->model->execute());
155 $this->requestMock->expects($this->once())
157 ->willReturn(
'true');
159 $this->assertInstanceOf(ResultInterface::class, $this->model->execute());
testExecuteToBeRedirect()