Skip to content

Commit 2d807c9

Browse files
Add positive unlink test
1 parent 5d79eb9 commit 2d807c9

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/phpbu/Backup/File/YandexDiskTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,28 @@ public function testCreateFileWithCorrectProperties()
3636
$this->assertEquals(1525788894, $file->getMTime());
3737
}
3838

39+
/**
40+
* Tests YandexDisk::unlink
41+
* @throws ReflectionException
42+
* @throws Exception
43+
*/
44+
public function testYandexDiskDeleteFile()
45+
{
46+
$yandexDiskFileStub = $this->prepareClosedStub();
47+
$yandexDiskFileStub->expects($this->once())
48+
->method('delete')
49+
->with('backups/dump.tar.gz');
50+
51+
$yandexDiskStub = $this->prepareDiskStub();
52+
$yandexDiskStub->expects($this->once())
53+
->method('getResource')
54+
->with('backups/dump.tar.gz')
55+
->willReturn($yandexDiskFileStub);
56+
57+
$file = new YandexDisk($yandexDiskStub, $yandexDiskFileStub);
58+
$file->unlink();
59+
}
60+
3961
/**
4062
* Tests YandexDisk::unlink
4163
* @throws ReflectionException
@@ -44,6 +66,7 @@ public function testCreateFileWithCorrectProperties()
4466
public function testYandexDiskDeleteFailure()
4567
{
4668
$this->expectException(Exception::class);
69+
4770
$yandexDiskFileStub = $this->prepareClosedStub();
4871
$yandexDiskFileStub->expects($this->once())
4972
->method('delete')

0 commit comments

Comments
 (0)