20
20
use OCP \IUser ;
21
21
use OCP \Notification \IManager ;
22
22
use OCP \Notification \INotification ;
23
+ use OCP \ServerVersion ;
23
24
use PHPUnit \Framework \MockObject \MockObject ;
24
25
use Test \TestCase ;
25
26
26
27
class UpdateAvailableNotificationsTest extends TestCase {
28
+ private ServerVersion $ serverVersion ;
27
29
private IConfig |MockObject $ config ;
28
30
private IManager |MockObject $ notificationManager ;
29
31
private IGroupManager |MockObject $ groupManager ;
@@ -36,6 +38,7 @@ class UpdateAvailableNotificationsTest extends TestCase {
36
38
protected function setUp (): void {
37
39
parent ::setUp ();
38
40
41
+ $ this ->serverVersion = $ this ->createMock (ServerVersion::class);
39
42
$ this ->config = $ this ->createMock (IConfig::class);
40
43
$ this ->appConfig = $ this ->createMock (IAppConfig::class);
41
44
$ this ->notificationManager = $ this ->createMock (IManager::class);
@@ -54,6 +57,7 @@ protected function getJob(array $methods = []) {
54
57
if (empty ($ methods )) {
55
58
return new UpdateAvailableNotifications (
56
59
$ this ->timeFactory ,
60
+ $ this ->serverVersion ,
57
61
$ this ->config ,
58
62
$ this ->appConfig ,
59
63
$ this ->notificationManager ,
@@ -67,6 +71,7 @@ protected function getJob(array $methods = []) {
67
71
return $ this ->getMockBuilder (UpdateAvailableNotifications::class)
68
72
->setConstructorArgs ([
69
73
$ this ->timeFactory ,
74
+ $ this ->serverVersion ,
70
75
$ this ->config ,
71
76
$ this ->appConfig ,
72
77
$ this ->notificationManager ,
@@ -158,13 +163,12 @@ public function dataCheckCoreUpdate(): array {
158
163
*/
159
164
public function testCheckCoreUpdate (string $ channel , $ versionCheck , $ version , $ readableVersion , $ errorDays ): void {
160
165
$ job = $ this ->getJob ([
161
- 'getChannel ' ,
162
166
'createNotifications ' ,
163
167
'clearErrorNotifications ' ,
164
168
'sendErrorNotifications ' ,
165
169
]);
166
170
167
- $ job ->expects ($ this ->once ())
171
+ $ this -> serverVersion ->expects ($ this ->once ())
168
172
->method ('getChannel ' )
169
173
->willReturn ($ channel );
170
174
0 commit comments