File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff 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 ' )
You can’t perform that action at this time.
0 commit comments