11<?php
22namespace phpbu \App \Backup \Check ;
33
4+ use phpbu \App \Backup \Collector \Local ;
5+ use phpbu \App \Backup \Target ;
6+ use phpbu \App \Result ;
7+
48/**
59 * SizeDiffPreviousPercentTest
610 *
@@ -19,19 +23,19 @@ class SizeDiffPreviousPercentTest extends \PHPUnit\Framework\TestCase
1923 */
2024 public function testPass ()
2125 {
22- $ resultStub = $ this ->createMock (\ phpbu \ App \ Result::class);
23- $ collectorStub = $ this ->createMock (\ phpbu \ App \ Backup \ Collector \ Local::class);
26+ $ resultStub = $ this ->createMock (Result::class);
27+ $ collectorStub = $ this ->createMock (Local::class);
2428 $ collectorStub ->expects ($ this ->once ())
2529 ->method ('getBackupFiles ' )
26- ->willReturn ($ this ->getFileListMock ([100 , 500 , 1000 ]));
27- $ targetStub = $ this ->createMock (\ phpbu \ App \ Backup \ Target::class);
30+ ->willReturn ($ this ->getFileListMock ([100 , 500 , 1000 , 1060 ]));
31+ $ targetStub = $ this ->createMock (Target::class);
2832 $ targetStub ->method ('getSize ' )->willReturn (1060 );
2933
3034 $ check = new SizeDiffPreviousPercent ();
3135
3236 $ this ->assertTrue (
3337 $ check ->pass ($ targetStub , '10 ' , $ collectorStub , $ resultStub ),
34- 'size of stub should be about 900 - 1100 '
38+ 'size of 1060 should be in range of 900 - 1100 '
3539 );
3640 }
3741
@@ -40,19 +44,19 @@ public function testPass()
4044 */
4145 public function testFail ()
4246 {
43- $ resultStub = $ this ->createMock (\ phpbu \ App \ Result::class);
44- $ collectorStub = $ this ->createMock (\ phpbu \ App \ Backup \ Collector \ Local::class);
47+ $ resultStub = $ this ->createMock (Result::class);
48+ $ collectorStub = $ this ->createMock (Local::class);
4549 $ collectorStub ->expects ($ this ->once ())
4650 ->method ('getBackupFiles ' )
47- ->willReturn ($ this ->getFileListMock ([100 , 500 , 1000 ]));
48- $ targetStub = $ this ->createMock (\ phpbu \ App \ Backup \ Target::class);
51+ ->willReturn ($ this ->getFileListMock ([100 , 500 , 1000 , 1060 ]));
52+ $ targetStub = $ this ->createMock (Target::class);
4953 $ targetStub ->method ('getSize ' )->willReturn (1060 );
5054
5155 $ check = new SizeDiffPreviousPercent ();
5256
5357 $ this ->assertFalse (
5458 $ check ->pass ($ targetStub , '5 ' , $ collectorStub , $ resultStub ),
55- 'size of stub should be about 900 - 1100 '
59+ 'size of 1060 should not be in rage of 950 - 1050 '
5660 );
5761 }
5862
@@ -61,9 +65,9 @@ public function testFail()
6165 */
6266 public function testSimulate ()
6367 {
64- $ collectorStub = $ this ->createMock (\ phpbu \ App \ Backup \ Collector \ Local::class);
65- $ targetStub = $ this ->createMock (\ phpbu \ App \ Backup \ Target::class);
66- $ resultStub = $ this ->createMock (\ phpbu \ App \ Result::class);
68+ $ collectorStub = $ this ->createMock (Local::class);
69+ $ targetStub = $ this ->createMock (Target::class);
70+ $ resultStub = $ this ->createMock (Result::class);
6771 $ resultStub ->expects ($ this ->once ())->method ('debug ' );
6872
6973 $ check = new SizeDiffPreviousPercent ();
0 commit comments