Ejemplo n.º 1
0
 protected function setUp()
 {
     $this->_backupDbMock = $this->getMock('Magento\\Framework\\Backup\\Db', array(), array(), '', false);
     $this->_backupDbMock->expects($this->any())->method('setBackupExtension')->will($this->returnSelf());
     $this->_backupDbMock->expects($this->any())->method('setTime')->will($this->returnSelf());
     $this->_backupDbMock->expects($this->any())->method('setBackupsDir')->will($this->returnSelf());
     $this->_backupDbMock->expects($this->any())->method('setResourceModel')->will($this->returnSelf());
     $this->_backupDbMock->expects($this->any())->method('getBackupPath')->will($this->returnValue('\\unexistingpath'));
     $this->_backupDbMock->expects($this->any())->method('create')->will($this->returnValue(true));
     $this->_filesystemMock = $this->getMock('Magento\\Framework\\App\\Filesystem', array(), array(), '', false);
     $this->_backupFactoryMock = $this->getMock('Magento\\Framework\\Backup\\Factory', array(), array(), '', false);
     $this->_backupFactoryMock->expects($this->once())->method('create')->will($this->returnValue($this->_backupDbMock));
 }
Ejemplo n.º 2
0
 protected function setUp()
 {
     $this->_backupDbMock = $this->getMock('Magento\\Framework\\Backup\\Db', [], [], '', false);
     $this->_backupDbMock->expects($this->any())->method('setBackupExtension')->will($this->returnSelf());
     $this->_backupDbMock->expects($this->any())->method('setTime')->will($this->returnSelf());
     $this->_backupDbMock->expects($this->any())->method('setBackupsDir')->will($this->returnSelf());
     $this->_backupDbMock->expects($this->any())->method('setResourceModel')->will($this->returnSelf());
     $this->_backupDbMock->expects($this->any())->method('getBackupPath')->will($this->returnValue('\\unexistingpath'));
     $this->_backupDbMock->expects($this->any())->method('create')->will($this->returnValue(true));
     $this->_filesystemMock = $this->getMock('Magento\\Framework\\Filesystem', [], [], '', false);
     $dirMock = $this->getMockForAbstractClass('\\Magento\\Framework\\Filesystem\\Directory\\WriteInterface');
     $this->_filesystemMock->expects($this->any())->method('getDirectoryWrite')->will($this->returnValue($dirMock));
     $this->_backupFactoryMock = $this->getMock('Magento\\Framework\\Backup\\Factory', [], [], '', false);
     $this->_backupFactoryMock->expects($this->once())->method('create')->will($this->returnValue($this->_backupDbMock));
 }
Ejemplo n.º 3
0
 private function setupDbBackupRollback()
 {
     $this->database->expects($this->once())
         ->method('setBackupsDir');
     $this->database->expects($this->once())
         ->method('setBackupExtension');
     $this->database->expects($this->once())
         ->method('setTime');
     $this->database->expects($this->once())
         ->method('getBackupFilename')
         ->willReturn('RollbackFile_A.gz');
     $this->database->expects($this->once())
         ->method('getBackupPath')
         ->willReturn('pathToFile/12345_db.tgz');
     $this->log->expects($this->once())
         ->method('logSuccess');
 }
Ejemplo n.º 4
0
 public function testGetDBDiskSpace()
 {
     $this->database->expects($this->once())->method('getDBSize')->willReturn(100);
     $size = $this->model->getDBDiskSpace();
     $this->assertEquals(100, $size);
 }