2020use OCP \IUser ;
2121use OCP \Notification \IManager ;
2222use OCP \Notification \INotification ;
23+ use OCP \ServerVersion ;
2324use PHPUnit \Framework \MockObject \MockObject ;
2425use Test \TestCase ;
2526
2627class UpdateAvailableNotificationsTest extends TestCase {
28+ private ServerVersion $ serverVersion ;
2729 private IConfig |MockObject $ config ;
2830 private IManager |MockObject $ notificationManager ;
2931 private IGroupManager |MockObject $ groupManager ;
@@ -36,6 +38,7 @@ class UpdateAvailableNotificationsTest extends TestCase {
3638 protected function setUp (): void {
3739 parent ::setUp ();
3840
41+ $ this ->serverVersion = $ this ->createMock (ServerVersion::class);
3942 $ this ->config = $ this ->createMock (IConfig::class);
4043 $ this ->appConfig = $ this ->createMock (IAppConfig::class);
4144 $ this ->notificationManager = $ this ->createMock (IManager::class);
@@ -54,6 +57,7 @@ protected function getJob(array $methods = []) {
5457 if (empty ($ methods )) {
5558 return new UpdateAvailableNotifications (
5659 $ this ->timeFactory ,
60+ $ this ->serverVersion ,
5761 $ this ->config ,
5862 $ this ->appConfig ,
5963 $ this ->notificationManager ,
@@ -67,6 +71,7 @@ protected function getJob(array $methods = []) {
6771 return $ this ->getMockBuilder (UpdateAvailableNotifications::class)
6872 ->setConstructorArgs ([
6973 $ this ->timeFactory ,
74+ $ this ->serverVersion ,
7075 $ this ->config ,
7176 $ this ->appConfig ,
7277 $ this ->notificationManager ,
@@ -162,13 +167,12 @@ public function dataCheckCoreUpdate(): array {
162167 */
163168 public function testCheckCoreUpdate (string $ channel , $ versionCheck , $ version , $ readableVersion , $ errorDays ) {
164169 $ job = $ this ->getJob ([
165- 'getChannel ' ,
166170 'createNotifications ' ,
167171 'clearErrorNotifications ' ,
168172 'sendErrorNotifications ' ,
169173 ]);
170174
171- $ job ->expects ($ this ->once ())
175+ $ this -> serverVersion ->expects ($ this ->once ())
172176 ->method ('getChannel ' )
173177 ->willReturn ($ channel );
174178
0 commit comments