コード例 #1
0
 public function setUp()
 {
     $this->directoryList = $this->getMock('Magento\\Framework\\App\\Filesystem\\DirectoryList', [], [], '', false);
     $this->objectManagerProvider = $this->getMock('Magento\\Setup\\Model\\ObjectManagerProvider', [], [], '', false);
     $this->backupRollback = $this->getMock('Magento\\Setup\\Model\\BackupRollback', ['getDBDiskSpace', 'dbBackup'], [], '', false);
     $objectManager = $this->getMock('Magento\\Framework\\ObjectManagerInterface', [], [], '', false);
     $objectManager->expects($this->once())->method('create')->willReturn($this->backupRollback);
     $this->objectManagerProvider->expects($this->once())->method('get')->willReturn($objectManager);
     $this->log = $this->getMock('Magento\\Setup\\Model\\WebLogger', [], [], '', false);
     $this->filesystem = $this->getMock('Magento\\Framework\\Backup\\Filesystem', [], [], '', false);
     $this->controller = new BackupActionItems($this->objectManagerProvider, $this->log, $this->directoryList, $this->filesystem);
     $request = $this->getMock('\\Zend\\Http\\PhpEnvironment\\Request', [], [], '', false);
     $response = $this->getMock('\\Zend\\Http\\PhpEnvironment\\Response', [], [], '', false);
     $routeMatch = $this->getMock('\\Zend\\Mvc\\Router\\RouteMatch', [], [], '', false);
     $mvcEvent = $this->getMock('\\Zend\\Mvc\\MvcEvent', [], [], '', false);
     $mvcEvent->expects($this->any())->method('setRequest')->with($request)->willReturn($mvcEvent);
     $mvcEvent->expects($this->any())->method('setResponse')->with($response)->willReturn($mvcEvent);
     $mvcEvent->expects($this->any())->method('setTarget')->with($this->controller)->willReturn($mvcEvent);
     $mvcEvent->expects($this->any())->method('getRouteMatch')->willReturn($routeMatch);
     $contentArray = '{"options":{"code":false,"media":false,"db":true}}';
     $request->expects($this->any())->method('getContent')->willReturn($contentArray);
     $this->controller->setEvent($mvcEvent);
     $this->controller->dispatch($request, $response);
 }