Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SnapshotTest.php
Go to the documentation of this file.
1 <?php
7 
8 class SnapshotTest extends \PHPUnit\Framework\TestCase
9 {
10  public function testGetDbBackupFilename()
11  {
12  $filesystem = $this->createMock(\Magento\Framework\Filesystem::class);
13  $backupFactory = $this->createMock(\Magento\Framework\Backup\Factory::class);
14  $manager = $this->getMockBuilder(\Magento\Framework\Backup\Snapshot::class)
15  ->setMethods(['getBackupFilename'])
16  ->setConstructorArgs([$filesystem, $backupFactory])
17  ->getMock();
18 
19  $file = 'var/backup/2.sql';
20  $manager->expects($this->once())->method('getBackupFilename')->will($this->returnValue($file));
21 
22  $model = new \Magento\Framework\Backup\Snapshot($filesystem, $backupFactory);
23  $model->setDbBackupManager($manager);
24  $this->assertEquals($file, $model->getDbBackupFilename());
25  }
26 }
$filesystem