27
27
use OCP \App \IAppManager ;
28
28
use PHPUnit \Framework \MockObject \MockObject ;
29
29
use PHPUnit \Framework \TestCase ;
30
+ use Psr \Log \LoggerInterface ;
30
31
31
32
/**
32
33
* Class FetcherConfigTest
@@ -49,6 +50,9 @@ class FetcherConfigTest extends TestCase
49
50
/** @var FetcherConfig */
50
51
protected $ class ;
51
52
53
+ /** @var MockObject|LoggerInterface */
54
+ protected $ logger ;
55
+
52
56
protected function setUp (): void
53
57
{
54
58
$ this ->config = $ this ->getMockBuilder (IAppConfig::class)
@@ -62,14 +66,19 @@ protected function setUp(): void
62
66
$ this ->appmanager = $ this ->getMockBuilder (IAppManager::class)
63
67
->disableOriginalConstructor ()
64
68
->getMock ();
69
+
70
+ $ this ->logger = $ this ->getMockBuilder (LoggerInterface::class)
71
+ ->disableOriginalConstructor ()
72
+ ->getMock ();
73
+
65
74
}
66
75
67
76
/**
68
77
* Test a valid call will work
69
78
*/
70
79
public function testGetClient ()
71
80
{
72
- $ this ->class = new FetcherConfig ($ this ->config , $ this ->sysconfig , $ this ->appmanager );
81
+ $ this ->class = new FetcherConfig ($ this ->config , $ this ->sysconfig , $ this ->appmanager , $ this -> logger );
73
82
74
83
$ this ->assertInstanceOf (FeedIoClient::class, $ this ->class ->getClient ());
75
84
}
@@ -87,7 +96,7 @@ public function testGetUserAgent()
87
96
->method ('getAppVersion ' )
88
97
->willReturn ('123.45 ' );
89
98
90
- $ this ->class = new FetcherConfig ($ this ->config , $ this ->sysconfig , $ this ->appmanager );
99
+ $ this ->class = new FetcherConfig ($ this ->config , $ this ->sysconfig , $ this ->appmanager , $ this -> logger );
91
100
92
101
$ expected = 'NextCloud-News/123.45 ' ;
93
102
$ response = $ this ->class ->getUserAgent ();
@@ -107,7 +116,7 @@ public function testGetUserAgentUnknownVersion()
107
116
->method ('getAppVersion ' )
108
117
->willReturn ('1.0 ' );
109
118
110
- $ this ->class = new FetcherConfig ($ this ->config , $ this ->sysconfig , $ this ->appmanager );
119
+ $ this ->class = new FetcherConfig ($ this ->config , $ this ->sysconfig , $ this ->appmanager , $ this -> logger );
111
120
112
121
$ expected = 'NextCloud-News/1.0 ' ;
113
122
$ response = $ this ->class ->getUserAgent ();
0 commit comments