示例#1
0
 public function testCreateInvalid()
 {
     $this->_backupModel->expects($this->never())->method('setType');
     $this->_backupModel->expects($this->never())->method('setTime');
     $this->_backupModel->expects($this->never())->method('setName');
     $this->_backupModel->expects($this->never())->method('setPath');
     $this->_instance->create('451094400', 'snapshot');
 }
示例#2
0
 /**
  * @covers \Magento\Backup\Controller\Adminhtml\Index\Download::execute
  * @param int $time
  * @param bool $exists
  * @param int $existsCount
  * @dataProvider executeBackupNotFoundDataProvider
  */
 public function testExecuteBackupNotFound($time, $exists, $existsCount)
 {
     $type = 'db';
     $this->backupModelMock->expects($this->atLeastOnce())->method('getTime')->willReturn($time);
     $this->backupModelMock->expects($this->exactly($existsCount))->method('exists')->willReturn($exists);
     $this->requestMock->expects($this->any())->method('getParam')->willReturnMap([['time', null, $time], ['type', null, $type]]);
     $this->backupModelFactoryMock->expects($this->once())->method('create')->with($time, $type)->willReturn($this->backupModelMock);
     $this->resultRedirectMock->expects($this->once())->method('setPath')->with('backup/*');
     $this->resultRedirectFactoryMock->expects($this->once())->method('create')->willReturn($this->resultRedirectMock);
     $this->assertSame($this->resultRedirectMock, $this->downloadController->execute());
 }