public function testExecute() { $type = 'Magento\\CatalogWidget\\Model\\Rule\\Condition\\Product|attribute_set_id'; $this->request->expects($this->at(0))->method('getParam')->with('id')->will($this->returnValue('1--1')); $this->request->expects($this->at(1))->method('getParam')->with('type')->will($this->returnValue($type)); $this->request->expects($this->at(2))->method('getParam')->with('form')->will($this->returnValue('request_form_param_value')); $condition = $this->getMockBuilder('Magento\\CatalogWidget\\Model\\Rule\\Condition\\Product')->setMethods(['setId', 'setType', 'setRule', 'setPrefix', 'setAttribute', 'asHtmlRecursive', 'setJsFormObject'])->disableOriginalConstructor()->getMock(); $condition->expects($this->once())->method('setId')->with('1--1')->will($this->returnSelf()); $condition->expects($this->once())->method('setType')->with('Magento\\CatalogWidget\\Model\\Rule\\Condition\\Product')->will($this->returnSelf()); $condition->expects($this->once())->method('setRule')->with($this->rule)->will($this->returnSelf()); $condition->expects($this->once())->method('setPrefix')->with('conditions')->will($this->returnSelf()); $condition->expects($this->once())->method('setJsFormObject')->with('request_form_param_value')->will($this->returnSelf()); $condition->expects($this->once())->method('setAttribute')->with('attribute_set_id')->will($this->returnSelf()); $condition->expects($this->once())->method('asHtmlRecursive')->will($this->returnValue('<some_html>')); $this->objectManager->expects($this->once())->method('create')->will($this->returnValue($condition)); $this->response->expects($this->once())->method('setBody')->with('<some_html>')->will($this->returnSelf()); $this->controller->execute(); }
/** * {@inheritdoc} */ public function dispatch(\Magento\Framework\App\RequestInterface $request) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'dispatch'); if (!$pluginInfo) { return parent::dispatch($request); } else { return $this->___callPlugins('dispatch', func_get_args(), $pluginInfo); } }