11<?php
22namespace phpbu \App \Log \ResultFormatter ;
33
4+ use Exception ;
5+ use phpbu \App \Result ;
6+ use phpbu \App \Result \Backup ;
47use function GuzzleHttp \Psr7 \parse_query ;
58use PHPUnit \Framework \TestCase ;
69
@@ -25,7 +28,8 @@ public function testFormat()
2528 $ result = $ this ->getResultMock ();
2629 $ formatter = new FormData ();
2730 $ queryString = $ formatter ->format ($ result );
28- $ rawData = parse_query ($ queryString );
31+ $ rawData = [];
32+ parse_str ($ queryString , $ rawData );
2933
3034 $ this ->assertNotEmpty ($ queryString );
3135 $ this ->assertEquals (0 , $ rawData ['status ' ]);
@@ -39,12 +43,12 @@ public function testFormat()
3943 */
4044 protected function getResultMock ()
4145 {
42- $ result = $ this ->createMock (\ phpbu \ App \ Result::class);
46+ $ result = $ this ->createMock (Result::class);
4347 $ result ->expects ($ this ->once ())->method ('started ' )->willReturn (microtime (true ));
4448 $ result ->expects ($ this ->once ())->method ('allOk ' )->willReturn (true );
4549 $ result ->expects ($ this ->once ())->method ('backupsFailedCount ' )->willReturn (0 );
4650 $ result ->expects ($ this ->once ())->method ('errorCount ' )->willReturn (1 );
47- $ result ->expects ($ this ->once ())->method ('getErrors ' )->willReturn ([new \ Exception ('foo bar ' )]);
51+ $ result ->expects ($ this ->once ())->method ('getErrors ' )->willReturn ([new Exception ('foo bar ' )]);
4852 $ result ->expects ($ this ->once ())->method ('getBackups ' )->willReturn ([$ this ->getBackupResultMock ()]);
4953
5054 return $ result ;
@@ -57,7 +61,7 @@ protected function getResultMock()
5761 */
5862 protected function getBackupResultMock ()
5963 {
60- $ backup = $ this ->createMock (\ phpbu \ App \ Result \ Backup::class);
64+ $ backup = $ this ->createMock (Backup::class);
6165 $ backup ->method ('getName ' )->willReturn ('foo ' );
6266 $ backup ->method ('allOk ' )->willReturn (true );
6367 $ backup ->method ('checkCount ' )->willReturn (0 );
0 commit comments