Exemplo n.º 1
0
 public function testExecute()
 {
     $this->_getTreeBlock();
     $testHtml = '<div>Some test html</div>';
     $this->chooserBlockMock->expects($this->once())->method('toHtml')->will($this->returnValue($testHtml));
     $this->resultRaw->expects($this->once())->method('setContents')->with($testHtml);
     $this->controller->executeInternal();
 }
Exemplo n.º 2
0
 public function testExecute()
 {
     $this->_getTreeBlock();
     $testHtml = '<div>Some test html</div>';
     $this->chooserBlockMock->expects($this->once())->method('toHtml')->will($this->returnValue($testHtml));
     $this->responseMock->expects($this->once())->method('setBody')->with($this->equalTo($testHtml));
     $this->controller->execute();
 }
 public function testExecute()
 {
     $this->_getTreeBlock();
     $testCategoryId = 1;
     $this->requestMock->expects($this->any())->method('getPost')->will($this->returnValue($testCategoryId));
     $categoryMock = $this->getMock('Magento\\Catalog\\Model\\Category', [], [], '', false);
     $categoryMock->expects($this->once())->method('load')->will($this->returnValue($categoryMock));
     $categoryMock->expects($this->once())->method('getId')->will($this->returnValue($testCategoryId));
     $this->objectManagerMock->expects($this->once())->method('create')->with($this->equalTo('Magento\\Catalog\\Model\\Category'))->will($this->returnValue($categoryMock));
     $this->chooserBlockMock->expects($this->once())->method('setSelectedCategories')->will($this->returnValue($this->chooserBlockMock));
     $testHtml = '<div>Some test html</div>';
     $this->chooserBlockMock->expects($this->once())->method('getTreeJson')->will($this->returnValue($testHtml));
     $this->resultJson->expects($this->once())->method('setJsonData')->with($testHtml)->willReturnSelf();
     $this->controller->execute();
 }
 /**
  * @param \Magento\Backend\App\Action\Context $context
  * @param \Magento\Framework\View\LayoutFactory $layoutFactory
  * @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
  * @param \Magento\Framework\Registry $coreRegistry
  */
 public function __construct(\Magento\Backend\App\Action\Context $context, \Magento\Framework\View\LayoutFactory $layoutFactory, \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory, \Magento\Framework\Registry $coreRegistry)
 {
     parent::__construct($context, $layoutFactory);
     $this->resultJsonFactory = $resultJsonFactory;
     $this->_coreRegistry = $coreRegistry;
 }