Ejemplo n.º 1
0
 public function testExecute()
 {
     $this->objectManager->expects($this->once())->method('get')->with('Magento\\Theme\\Helper\\Storage')->willReturn($this->storageHelper);
     $this->storageHelper->expects($this->once())->method('getRelativeUrl')->willReturn('http://relative.url/');
     $this->response->expects($this->once())->method('setBody')->with('http://relative.url/');
     $this->controller->execute();
 }
Ejemplo n.º 2
0
    public function testExecute()
    {
        $this->storageHelper->expects($this->once())
            ->method('getCurrentPath')
            ->willReturn('/current/path/');

        $this->objectManager->expects($this->at(0))
            ->method('get')
            ->with('Magento\Theme\Model\Wysiwyg\Storage')
            ->willReturn($this->storage);
        $this->storage->expects($this->once())
            ->method('deleteDirectory')
            ->with('/current/path/')
            ->willThrowException(new \Exception('Message'));

        $jsonData = $this->getMock('Magento\Framework\Json\Helper\Data', [], [], '', false);
        $jsonData->expects($this->once())
            ->method('jsonEncode')
            ->with(['error' => true, 'message' => 'Message'])
            ->willReturn('{"error":"true","message":"Message"}');

        $this->objectManager->expects($this->at(1))
            ->method('get')
            ->with('Magento\Framework\Json\Helper\Data')
            ->willReturn($jsonData);

        $this->controller->executeInternal();
    }
Ejemplo n.º 3
0
    public function testExecute()
    {
        $this->view ->expects($this->once())
            ->method('loadLayout')
            ->with('overlay_popup');
        $this->view ->expects($this->once())
            ->method('renderLayout');

        $this->controller->executeInternal();
    }
Ejemplo n.º 4
0
 public function testExecute()
 {
     $this->request->expects($this->once())->method('isPost')->willReturn(true);
     $this->request->expects($this->once())->method('getParam')->with('files')->willReturn('{"files":"file"}');
     $jsonData = $this->getMock('Magento\\Framework\\Json\\Helper\\Data', [], [], '', false);
     $jsonData->expects($this->once())->method('jsonDecode')->with('{"files":"file"}')->willReturn(['files' => 'file']);
     $this->objectManager->expects($this->at(0))->method('get')->with('Magento\\Framework\\Json\\Helper\\Data')->willReturn($jsonData);
     $this->objectManager->expects($this->at(1))->method('get')->with('Magento\\Theme\\Model\\Wysiwyg\\Storage')->willReturn($this->storage);
     $this->storage->expects($this->once())->method('deleteFile')->with('file');
     $this->controller->execute();
 }
Ejemplo n.º 5
0
 public function testExecute()
 {
     $layout = $this->getMockForAbstractClass('Magento\\Framework\\View\\LayoutInterface', [], '', false);
     $storage = $this->getMock('Magento\\Theme\\Model\\Wysiwyg\\Storage', [], [], '', false);
     $block = $this->getMockForAbstractClass('Magento\\Framework\\View\\Element\\BlockInterface', [], '', false, false, true, ['setStorage']);
     $this->view->expects($this->once())->method('loadLayout')->with('empty');
     $this->view->expects($this->once())->method('getLayout')->willReturn($layout);
     $layout->expects($this->once())->method('getBlock')->with('wysiwyg_files.files')->willReturn($block);
     $block->expects($this->once())->method('setStorage')->with($storage);
     $this->objectManager->expects($this->at(0))->method('get')->with('Magento\\Theme\\Model\\Wysiwyg\\Storage')->willReturn($storage);
     $this->storage->expects($this->once())->method('getCurrentPath')->willThrowException(new \Exception('Message'));
     $jsonData = $this->getMock('Magento\\Framework\\Json\\Helper\\Data', [], [], '', false);
     $jsonData->expects($this->once())->method('jsonEncode')->with(['error' => true, 'message' => 'Message'])->willReturn('{"error":"true","message":"Message"}');
     $this->objectManager->expects($this->at(1))->method('get')->with('Magento\\Framework\\Json\\Helper\\Data')->willReturn($jsonData);
     $this->response->expects($this->once())->method('representJson');
     $this->controller->execute();
 }