@@ -17,6 +17,6 @@ |
||
17 | 17 | throw new RuntimeException($err); |
18 | 18 | } |
19 | 19 | |
20 | -require_once __DIR__ . '/composer/autoload_real.php'; |
|
20 | +require_once __DIR__.'/composer/autoload_real.php'; |
|
21 | 21 | |
22 | 22 | return ComposerAutoloaderInitUpdateNotification::getLoader(); |
@@ -30,442 +30,442 @@ |
||
30 | 30 | |
31 | 31 | class AdminTest extends TestCase { |
32 | 32 | |
33 | - private Admin $admin; |
|
34 | - |
|
35 | - private IFactory&MockObject $l10nFactory; |
|
36 | - private IConfig&MockObject $config; |
|
37 | - private IAppConfig&MockObject $appConfig; |
|
38 | - private UpdateChecker&MockObject $updateChecker; |
|
39 | - private IGroupManager&MockObject $groupManager; |
|
40 | - private IDateTimeFormatter&MockObject $dateTimeFormatter; |
|
41 | - private IRegistry&MockObject $subscriptionRegistry; |
|
42 | - private IUserManager&MockObject $userManager; |
|
43 | - private LoggerInterface&MockObject $logger; |
|
44 | - private IInitialState&MockObject $initialState; |
|
45 | - private ServerVersion&MockObject $serverVersion; |
|
46 | - |
|
47 | - protected function setUp(): void { |
|
48 | - parent::setUp(); |
|
49 | - |
|
50 | - $this->config = $this->createMock(IConfig::class); |
|
51 | - $this->appConfig = $this->createMock(IAppConfig::class); |
|
52 | - $this->updateChecker = $this->createMock(UpdateChecker::class); |
|
53 | - $this->groupManager = $this->createMock(IGroupManager::class); |
|
54 | - $this->dateTimeFormatter = $this->createMock(IDateTimeFormatter::class); |
|
55 | - $this->l10nFactory = $this->createMock(IFactory::class); |
|
56 | - $this->subscriptionRegistry = $this->createMock(IRegistry::class); |
|
57 | - $this->userManager = $this->createMock(IUserManager::class); |
|
58 | - $this->logger = $this->createMock(LoggerInterface::class); |
|
59 | - $this->initialState = $this->createMock(IInitialState::class); |
|
60 | - $this->serverVersion = $this->createMock(ServerVersion::class); |
|
61 | - |
|
62 | - $this->admin = new Admin( |
|
63 | - $this->config, |
|
64 | - $this->appConfig, |
|
65 | - $this->updateChecker, |
|
66 | - $this->groupManager, |
|
67 | - $this->dateTimeFormatter, |
|
68 | - $this->l10nFactory, |
|
69 | - $this->subscriptionRegistry, |
|
70 | - $this->userManager, |
|
71 | - $this->logger, |
|
72 | - $this->initialState, |
|
73 | - $this->serverVersion, |
|
74 | - ); |
|
75 | - } |
|
76 | - |
|
77 | - public function testGetFormWithUpdate(): void { |
|
78 | - $this->serverVersion->expects(self::atLeastOnce()) |
|
79 | - ->method('getChannel') |
|
80 | - ->willReturn('daily'); |
|
81 | - $this->userManager |
|
82 | - ->expects($this->once()) |
|
83 | - ->method('countUsersTotal') |
|
84 | - ->willReturn(5); |
|
85 | - $channels = [ |
|
86 | - 'daily', |
|
87 | - 'beta', |
|
88 | - 'stable', |
|
89 | - 'production', |
|
90 | - ]; |
|
91 | - $this->appConfig |
|
92 | - ->expects($this->once()) |
|
93 | - ->method('getValueInt') |
|
94 | - ->with('core', 'lastupdatedat', 0) |
|
95 | - ->willReturn(12345); |
|
96 | - $this->appConfig |
|
97 | - ->expects($this->once()) |
|
98 | - ->method('getValueArray') |
|
99 | - ->with(Application::APP_NAME, 'notify_groups', ['admin']) |
|
100 | - ->willReturn(['admin']); |
|
101 | - $this->config |
|
102 | - ->method('getSystemValue') |
|
103 | - ->willReturnMap([ |
|
104 | - ['updater.server.url', 'https://updates.nextcloud.com/updater_server/', 'https://updates.nextcloud.com/updater_server/'], |
|
105 | - ['upgrade.disable-web', false, false], |
|
106 | - ]); |
|
107 | - $this->config |
|
108 | - ->expects(self::any()) |
|
109 | - ->method('getSystemValueBool') |
|
110 | - ->with('updatechecker', true) |
|
111 | - ->willReturn(true); |
|
112 | - $this->dateTimeFormatter |
|
113 | - ->expects($this->once()) |
|
114 | - ->method('formatDateTime') |
|
115 | - ->with(12345) |
|
116 | - ->willReturn('LastCheckedReturnValue'); |
|
117 | - $this->updateChecker |
|
118 | - ->expects($this->once()) |
|
119 | - ->method('getUpdateState') |
|
120 | - ->willReturn([ |
|
121 | - 'updateAvailable' => true, |
|
122 | - 'updateVersion' => '8.1.2', |
|
123 | - 'updateVersionString' => 'Nextcloud 8.1.2', |
|
124 | - 'downloadLink' => 'https://downloads.nextcloud.org/server', |
|
125 | - 'changes' => [], |
|
126 | - 'updaterEnabled' => true, |
|
127 | - 'versionIsEol' => false, |
|
128 | - ]); |
|
129 | - |
|
130 | - $group = $this->createMock(IGroup::class); |
|
131 | - $group->expects($this->any()) |
|
132 | - ->method('getDisplayName') |
|
133 | - ->willReturn('Administrators'); |
|
134 | - $group->expects($this->any()) |
|
135 | - ->method('getGID') |
|
136 | - ->willReturn('admin'); |
|
137 | - $this->groupManager->expects($this->once()) |
|
138 | - ->method('get') |
|
139 | - ->with('admin') |
|
140 | - ->willReturn($group); |
|
141 | - |
|
142 | - $this->subscriptionRegistry |
|
143 | - ->expects($this->once()) |
|
144 | - ->method('delegateHasValidSubscription') |
|
145 | - ->willReturn(true); |
|
146 | - |
|
147 | - $this->initialState->expects($this->once()) |
|
148 | - ->method('provideInitialState') |
|
149 | - ->with('data', [ |
|
150 | - 'isNewVersionAvailable' => true, |
|
151 | - 'isUpdateChecked' => true, |
|
152 | - 'lastChecked' => 'LastCheckedReturnValue', |
|
153 | - 'currentChannel' => 'daily', |
|
154 | - 'channels' => $channels, |
|
155 | - 'newVersion' => '8.1.2', |
|
156 | - 'newVersionString' => 'Nextcloud 8.1.2', |
|
157 | - 'downloadLink' => 'https://downloads.nextcloud.org/server', |
|
158 | - 'changes' => [], |
|
159 | - 'webUpdaterEnabled' => true, |
|
160 | - 'isWebUpdaterRecommended' => true, |
|
161 | - 'updaterEnabled' => true, |
|
162 | - 'versionIsEol' => false, |
|
163 | - 'isDefaultUpdateServerURL' => true, |
|
164 | - 'updateServerURL' => 'https://updates.nextcloud.com/updater_server/', |
|
165 | - 'notifyGroups' => [ |
|
166 | - ['id' => 'admin', 'displayname' => 'Administrators'], |
|
167 | - ], |
|
168 | - 'hasValidSubscription' => true, |
|
169 | - ]); |
|
170 | - |
|
171 | - $expected = new TemplateResponse(Application::APP_NAME, 'admin', [], ''); |
|
172 | - $this->assertEquals($expected, $this->admin->getForm()); |
|
173 | - } |
|
174 | - |
|
175 | - public function testGetFormWithUpdateAndChangedUpdateServer(): void { |
|
176 | - $this->serverVersion->expects(self::atLeastOnce()) |
|
177 | - ->method('getChannel') |
|
178 | - ->willReturn('beta'); |
|
179 | - $this->userManager |
|
180 | - ->expects($this->once()) |
|
181 | - ->method('countUsersTotal') |
|
182 | - ->willReturn(5); |
|
183 | - $channels = [ |
|
184 | - 'daily', |
|
185 | - 'beta', |
|
186 | - 'stable', |
|
187 | - 'production', |
|
188 | - ]; |
|
189 | - |
|
190 | - $this->appConfig |
|
191 | - ->expects($this->once()) |
|
192 | - ->method('getValueInt') |
|
193 | - ->with('core', 'lastupdatedat', 0) |
|
194 | - ->willReturn(12345); |
|
195 | - $this->config |
|
196 | - ->expects(self::any()) |
|
197 | - ->method('getSystemValueBool') |
|
198 | - ->with('updatechecker', true) |
|
199 | - ->willReturn(true); |
|
200 | - $this->appConfig |
|
201 | - ->expects($this->once()) |
|
202 | - ->method('getValueArray') |
|
203 | - ->with(Application::APP_NAME, 'notify_groups', ['admin']) |
|
204 | - ->willReturn(['admin']); |
|
205 | - $this->config |
|
206 | - ->method('getSystemValue') |
|
207 | - ->willReturnMap([ |
|
208 | - ['updater.server.url', 'https://updates.nextcloud.com/updater_server/', 'https://updates.nextcloud.com/updater_server_changed/'], |
|
209 | - ['upgrade.disable-web', false, true], |
|
210 | - ]); |
|
211 | - $this->dateTimeFormatter |
|
212 | - ->expects($this->once()) |
|
213 | - ->method('formatDateTime') |
|
214 | - ->with('12345') |
|
215 | - ->willReturn('LastCheckedReturnValue'); |
|
216 | - $this->updateChecker |
|
217 | - ->expects($this->once()) |
|
218 | - ->method('getUpdateState') |
|
219 | - ->willReturn([ |
|
220 | - 'updateAvailable' => true, |
|
221 | - 'updateVersion' => '8.1.2', |
|
222 | - 'updateVersionString' => 'Nextcloud 8.1.2', |
|
223 | - 'downloadLink' => 'https://downloads.nextcloud.org/server', |
|
224 | - 'changes' => [], |
|
225 | - 'updaterEnabled' => true, |
|
226 | - 'versionIsEol' => false, |
|
227 | - ]); |
|
228 | - |
|
229 | - $group = $this->createMock(IGroup::class); |
|
230 | - $group->expects($this->any()) |
|
231 | - ->method('getDisplayName') |
|
232 | - ->willReturn('Administrators'); |
|
233 | - $group->expects($this->any()) |
|
234 | - ->method('getGID') |
|
235 | - ->willReturn('admin'); |
|
236 | - $this->groupManager->expects($this->once()) |
|
237 | - ->method('get') |
|
238 | - ->with('admin') |
|
239 | - ->willReturn($group); |
|
240 | - |
|
241 | - $this->subscriptionRegistry |
|
242 | - ->expects($this->once()) |
|
243 | - ->method('delegateHasValidSubscription') |
|
244 | - ->willReturn(true); |
|
245 | - |
|
246 | - $this->initialState->expects($this->once()) |
|
247 | - ->method('provideInitialState') |
|
248 | - ->with('data', [ |
|
249 | - 'isNewVersionAvailable' => true, |
|
250 | - 'isUpdateChecked' => true, |
|
251 | - 'lastChecked' => 'LastCheckedReturnValue', |
|
252 | - 'currentChannel' => 'beta', |
|
253 | - 'channels' => $channels, |
|
254 | - 'newVersion' => '8.1.2', |
|
255 | - 'newVersionString' => 'Nextcloud 8.1.2', |
|
256 | - 'downloadLink' => 'https://downloads.nextcloud.org/server', |
|
257 | - 'changes' => [], |
|
258 | - 'webUpdaterEnabled' => false, |
|
259 | - 'isWebUpdaterRecommended' => true, |
|
260 | - 'updaterEnabled' => true, |
|
261 | - 'versionIsEol' => false, |
|
262 | - 'isDefaultUpdateServerURL' => false, |
|
263 | - 'updateServerURL' => 'https://updates.nextcloud.com/updater_server_changed/', |
|
264 | - 'notifyGroups' => [ |
|
265 | - ['id' => 'admin', 'displayname' => 'Administrators'], |
|
266 | - ], |
|
267 | - 'hasValidSubscription' => true, |
|
268 | - ]); |
|
269 | - |
|
270 | - $expected = new TemplateResponse(Application::APP_NAME, 'admin', [], ''); |
|
271 | - $this->assertEquals($expected, $this->admin->getForm()); |
|
272 | - } |
|
273 | - |
|
274 | - public function testGetFormWithUpdateAndCustomersUpdateServer(): void { |
|
275 | - $this->serverVersion->expects(self::atLeastOnce()) |
|
276 | - ->method('getChannel') |
|
277 | - ->willReturn('production'); |
|
278 | - $this->userManager |
|
279 | - ->expects($this->once()) |
|
280 | - ->method('countUsersTotal') |
|
281 | - ->willReturn(5); |
|
282 | - $channels = [ |
|
283 | - 'daily', |
|
284 | - 'beta', |
|
285 | - 'stable', |
|
286 | - 'production', |
|
287 | - ]; |
|
288 | - |
|
289 | - $this->appConfig |
|
290 | - ->expects($this->once()) |
|
291 | - ->method('getValueInt') |
|
292 | - ->with('core', 'lastupdatedat', 0) |
|
293 | - ->willReturn(12345); |
|
294 | - $this->config |
|
295 | - ->expects(self::any()) |
|
296 | - ->method('getSystemValueBool') |
|
297 | - ->with('updatechecker', true) |
|
298 | - ->willReturn(true); |
|
299 | - $this->appConfig |
|
300 | - ->expects(self::once()) |
|
301 | - ->method('getValueArray') |
|
302 | - ->with(Application::APP_NAME, 'notify_groups', ['admin']) |
|
303 | - ->willReturn(['admin']); |
|
304 | - $this->config |
|
305 | - ->method('getSystemValue') |
|
306 | - ->willReturnMap([ |
|
307 | - ['updater.server.url', 'https://updates.nextcloud.com/updater_server/', 'https://updates.nextcloud.com/customers/ABC-DEF/'], |
|
308 | - ['upgrade.disable-web', false, false], |
|
309 | - ]); |
|
310 | - $this->dateTimeFormatter |
|
311 | - ->expects($this->once()) |
|
312 | - ->method('formatDateTime') |
|
313 | - ->with('12345') |
|
314 | - ->willReturn('LastCheckedReturnValue'); |
|
315 | - $this->updateChecker |
|
316 | - ->expects($this->once()) |
|
317 | - ->method('getUpdateState') |
|
318 | - ->willReturn([ |
|
319 | - 'updateAvailable' => true, |
|
320 | - 'updateVersion' => '8.1.2', |
|
321 | - 'updateVersionString' => 'Nextcloud 8.1.2', |
|
322 | - 'downloadLink' => 'https://downloads.nextcloud.org/server', |
|
323 | - 'changes' => [], |
|
324 | - 'updaterEnabled' => true, |
|
325 | - 'versionIsEol' => false, |
|
326 | - ]); |
|
327 | - |
|
328 | - $group = $this->createMock(IGroup::class); |
|
329 | - $group->expects($this->any()) |
|
330 | - ->method('getDisplayName') |
|
331 | - ->willReturn('Administrators'); |
|
332 | - $group->expects($this->any()) |
|
333 | - ->method('getGID') |
|
334 | - ->willReturn('admin'); |
|
335 | - $this->groupManager->expects($this->once()) |
|
336 | - ->method('get') |
|
337 | - ->with('admin') |
|
338 | - ->willReturn($group); |
|
339 | - |
|
340 | - $this->subscriptionRegistry |
|
341 | - ->expects($this->once()) |
|
342 | - ->method('delegateHasValidSubscription') |
|
343 | - ->willReturn(true); |
|
344 | - |
|
345 | - $this->initialState->expects($this->once()) |
|
346 | - ->method('provideInitialState') |
|
347 | - ->with('data', [ |
|
348 | - 'isNewVersionAvailable' => true, |
|
349 | - 'isUpdateChecked' => true, |
|
350 | - 'lastChecked' => 'LastCheckedReturnValue', |
|
351 | - 'currentChannel' => 'production', |
|
352 | - 'channels' => $channels, |
|
353 | - 'newVersion' => '8.1.2', |
|
354 | - 'newVersionString' => 'Nextcloud 8.1.2', |
|
355 | - 'downloadLink' => 'https://downloads.nextcloud.org/server', |
|
356 | - 'changes' => [], |
|
357 | - 'webUpdaterEnabled' => true, |
|
358 | - 'isWebUpdaterRecommended' => true, |
|
359 | - 'updaterEnabled' => true, |
|
360 | - 'versionIsEol' => false, |
|
361 | - 'isDefaultUpdateServerURL' => true, |
|
362 | - 'updateServerURL' => 'https://updates.nextcloud.com/customers/ABC-DEF/', |
|
363 | - 'notifyGroups' => [ |
|
364 | - ['id' => 'admin', 'displayname' => 'Administrators'], |
|
365 | - ], |
|
366 | - 'hasValidSubscription' => true, |
|
367 | - ]); |
|
368 | - |
|
369 | - $expected = new TemplateResponse(Application::APP_NAME, 'admin', [], ''); |
|
370 | - $this->assertEquals($expected, $this->admin->getForm()); |
|
371 | - } |
|
372 | - |
|
373 | - |
|
374 | - public function testGetSection(): void { |
|
375 | - $this->config |
|
376 | - ->expects(self::atLeastOnce()) |
|
377 | - ->method('getSystemValueBool') |
|
378 | - ->with('updatechecker', true) |
|
379 | - ->willReturn(true); |
|
380 | - |
|
381 | - $this->assertSame('overview', $this->admin->getSection()); |
|
382 | - } |
|
383 | - |
|
384 | - public function testGetSectionDisabled(): void { |
|
385 | - $this->config |
|
386 | - ->expects(self::atLeastOnce()) |
|
387 | - ->method('getSystemValueBool') |
|
388 | - ->with('updatechecker', true) |
|
389 | - ->willReturn(false); |
|
390 | - |
|
391 | - $this->assertNull($this->admin->getSection()); |
|
392 | - } |
|
393 | - |
|
394 | - public function testGetPriority(): void { |
|
395 | - $this->assertSame(11, $this->admin->getPriority()); |
|
396 | - } |
|
397 | - |
|
398 | - public function changesProvider() { |
|
399 | - return [ |
|
400 | - [ #0, all info, en |
|
401 | - [ |
|
402 | - 'changelogURL' => 'https://go.to.changelog', |
|
403 | - 'whatsNew' => [ |
|
404 | - 'en' => [ |
|
405 | - 'regular' => ['content'], |
|
406 | - ], |
|
407 | - 'de' => [ |
|
408 | - 'regular' => ['inhalt'], |
|
409 | - ] |
|
410 | - ], |
|
411 | - ], |
|
412 | - 'en', |
|
413 | - [ |
|
414 | - 'changelogURL' => 'https://go.to.changelog', |
|
415 | - 'whatsNew' => [ |
|
416 | - 'regular' => ['content'], |
|
417 | - ], |
|
418 | - ] |
|
419 | - ], |
|
420 | - [ #1, all info, de |
|
421 | - [ |
|
422 | - 'changelogURL' => 'https://go.to.changelog', |
|
423 | - 'whatsNew' => [ |
|
424 | - 'en' => [ |
|
425 | - 'regular' => ['content'], |
|
426 | - ], |
|
427 | - 'de' => [ |
|
428 | - 'regular' => ['inhalt'], |
|
429 | - ] |
|
430 | - ], |
|
431 | - ], |
|
432 | - 'de', |
|
433 | - [ |
|
434 | - 'changelogURL' => 'https://go.to.changelog', |
|
435 | - 'whatsNew' => [ |
|
436 | - 'regular' => ['inhalt'], |
|
437 | - ] |
|
438 | - ], |
|
439 | - ], |
|
440 | - [ #2, just changelog |
|
441 | - [ 'changelogURL' => 'https://go.to.changelog' ], |
|
442 | - 'en', |
|
443 | - [ 'changelogURL' => 'https://go.to.changelog' ], |
|
444 | - ], |
|
445 | - [ #3 nothing |
|
446 | - [], |
|
447 | - 'ru', |
|
448 | - [] |
|
449 | - ] |
|
450 | - ]; |
|
451 | - } |
|
452 | - |
|
453 | - /** |
|
454 | - * @dataProvider changesProvider |
|
455 | - */ |
|
456 | - public function testFilterChanges($changes, $userLang, $expectation): void { |
|
457 | - $iterator = $this->createMock(ILanguageIterator::class); |
|
458 | - $iterator->expects($this->any()) |
|
459 | - ->method('current') |
|
460 | - ->willReturnOnConsecutiveCalls('es', $userLang, 'it', 'en'); |
|
461 | - $iterator->expects($this->any()) |
|
462 | - ->method('valid') |
|
463 | - ->willReturn(true); |
|
464 | - |
|
465 | - $this->l10nFactory->expects($this->atMost(1)) |
|
466 | - ->method('getLanguageIterator') |
|
467 | - ->willReturn($iterator); |
|
468 | - $result = $this->invokePrivate($this->admin, 'filterChanges', [$changes]); |
|
469 | - $this->assertSame($expectation, $result); |
|
470 | - } |
|
33 | + private Admin $admin; |
|
34 | + |
|
35 | + private IFactory&MockObject $l10nFactory; |
|
36 | + private IConfig&MockObject $config; |
|
37 | + private IAppConfig&MockObject $appConfig; |
|
38 | + private UpdateChecker&MockObject $updateChecker; |
|
39 | + private IGroupManager&MockObject $groupManager; |
|
40 | + private IDateTimeFormatter&MockObject $dateTimeFormatter; |
|
41 | + private IRegistry&MockObject $subscriptionRegistry; |
|
42 | + private IUserManager&MockObject $userManager; |
|
43 | + private LoggerInterface&MockObject $logger; |
|
44 | + private IInitialState&MockObject $initialState; |
|
45 | + private ServerVersion&MockObject $serverVersion; |
|
46 | + |
|
47 | + protected function setUp(): void { |
|
48 | + parent::setUp(); |
|
49 | + |
|
50 | + $this->config = $this->createMock(IConfig::class); |
|
51 | + $this->appConfig = $this->createMock(IAppConfig::class); |
|
52 | + $this->updateChecker = $this->createMock(UpdateChecker::class); |
|
53 | + $this->groupManager = $this->createMock(IGroupManager::class); |
|
54 | + $this->dateTimeFormatter = $this->createMock(IDateTimeFormatter::class); |
|
55 | + $this->l10nFactory = $this->createMock(IFactory::class); |
|
56 | + $this->subscriptionRegistry = $this->createMock(IRegistry::class); |
|
57 | + $this->userManager = $this->createMock(IUserManager::class); |
|
58 | + $this->logger = $this->createMock(LoggerInterface::class); |
|
59 | + $this->initialState = $this->createMock(IInitialState::class); |
|
60 | + $this->serverVersion = $this->createMock(ServerVersion::class); |
|
61 | + |
|
62 | + $this->admin = new Admin( |
|
63 | + $this->config, |
|
64 | + $this->appConfig, |
|
65 | + $this->updateChecker, |
|
66 | + $this->groupManager, |
|
67 | + $this->dateTimeFormatter, |
|
68 | + $this->l10nFactory, |
|
69 | + $this->subscriptionRegistry, |
|
70 | + $this->userManager, |
|
71 | + $this->logger, |
|
72 | + $this->initialState, |
|
73 | + $this->serverVersion, |
|
74 | + ); |
|
75 | + } |
|
76 | + |
|
77 | + public function testGetFormWithUpdate(): void { |
|
78 | + $this->serverVersion->expects(self::atLeastOnce()) |
|
79 | + ->method('getChannel') |
|
80 | + ->willReturn('daily'); |
|
81 | + $this->userManager |
|
82 | + ->expects($this->once()) |
|
83 | + ->method('countUsersTotal') |
|
84 | + ->willReturn(5); |
|
85 | + $channels = [ |
|
86 | + 'daily', |
|
87 | + 'beta', |
|
88 | + 'stable', |
|
89 | + 'production', |
|
90 | + ]; |
|
91 | + $this->appConfig |
|
92 | + ->expects($this->once()) |
|
93 | + ->method('getValueInt') |
|
94 | + ->with('core', 'lastupdatedat', 0) |
|
95 | + ->willReturn(12345); |
|
96 | + $this->appConfig |
|
97 | + ->expects($this->once()) |
|
98 | + ->method('getValueArray') |
|
99 | + ->with(Application::APP_NAME, 'notify_groups', ['admin']) |
|
100 | + ->willReturn(['admin']); |
|
101 | + $this->config |
|
102 | + ->method('getSystemValue') |
|
103 | + ->willReturnMap([ |
|
104 | + ['updater.server.url', 'https://updates.nextcloud.com/updater_server/', 'https://updates.nextcloud.com/updater_server/'], |
|
105 | + ['upgrade.disable-web', false, false], |
|
106 | + ]); |
|
107 | + $this->config |
|
108 | + ->expects(self::any()) |
|
109 | + ->method('getSystemValueBool') |
|
110 | + ->with('updatechecker', true) |
|
111 | + ->willReturn(true); |
|
112 | + $this->dateTimeFormatter |
|
113 | + ->expects($this->once()) |
|
114 | + ->method('formatDateTime') |
|
115 | + ->with(12345) |
|
116 | + ->willReturn('LastCheckedReturnValue'); |
|
117 | + $this->updateChecker |
|
118 | + ->expects($this->once()) |
|
119 | + ->method('getUpdateState') |
|
120 | + ->willReturn([ |
|
121 | + 'updateAvailable' => true, |
|
122 | + 'updateVersion' => '8.1.2', |
|
123 | + 'updateVersionString' => 'Nextcloud 8.1.2', |
|
124 | + 'downloadLink' => 'https://downloads.nextcloud.org/server', |
|
125 | + 'changes' => [], |
|
126 | + 'updaterEnabled' => true, |
|
127 | + 'versionIsEol' => false, |
|
128 | + ]); |
|
129 | + |
|
130 | + $group = $this->createMock(IGroup::class); |
|
131 | + $group->expects($this->any()) |
|
132 | + ->method('getDisplayName') |
|
133 | + ->willReturn('Administrators'); |
|
134 | + $group->expects($this->any()) |
|
135 | + ->method('getGID') |
|
136 | + ->willReturn('admin'); |
|
137 | + $this->groupManager->expects($this->once()) |
|
138 | + ->method('get') |
|
139 | + ->with('admin') |
|
140 | + ->willReturn($group); |
|
141 | + |
|
142 | + $this->subscriptionRegistry |
|
143 | + ->expects($this->once()) |
|
144 | + ->method('delegateHasValidSubscription') |
|
145 | + ->willReturn(true); |
|
146 | + |
|
147 | + $this->initialState->expects($this->once()) |
|
148 | + ->method('provideInitialState') |
|
149 | + ->with('data', [ |
|
150 | + 'isNewVersionAvailable' => true, |
|
151 | + 'isUpdateChecked' => true, |
|
152 | + 'lastChecked' => 'LastCheckedReturnValue', |
|
153 | + 'currentChannel' => 'daily', |
|
154 | + 'channels' => $channels, |
|
155 | + 'newVersion' => '8.1.2', |
|
156 | + 'newVersionString' => 'Nextcloud 8.1.2', |
|
157 | + 'downloadLink' => 'https://downloads.nextcloud.org/server', |
|
158 | + 'changes' => [], |
|
159 | + 'webUpdaterEnabled' => true, |
|
160 | + 'isWebUpdaterRecommended' => true, |
|
161 | + 'updaterEnabled' => true, |
|
162 | + 'versionIsEol' => false, |
|
163 | + 'isDefaultUpdateServerURL' => true, |
|
164 | + 'updateServerURL' => 'https://updates.nextcloud.com/updater_server/', |
|
165 | + 'notifyGroups' => [ |
|
166 | + ['id' => 'admin', 'displayname' => 'Administrators'], |
|
167 | + ], |
|
168 | + 'hasValidSubscription' => true, |
|
169 | + ]); |
|
170 | + |
|
171 | + $expected = new TemplateResponse(Application::APP_NAME, 'admin', [], ''); |
|
172 | + $this->assertEquals($expected, $this->admin->getForm()); |
|
173 | + } |
|
174 | + |
|
175 | + public function testGetFormWithUpdateAndChangedUpdateServer(): void { |
|
176 | + $this->serverVersion->expects(self::atLeastOnce()) |
|
177 | + ->method('getChannel') |
|
178 | + ->willReturn('beta'); |
|
179 | + $this->userManager |
|
180 | + ->expects($this->once()) |
|
181 | + ->method('countUsersTotal') |
|
182 | + ->willReturn(5); |
|
183 | + $channels = [ |
|
184 | + 'daily', |
|
185 | + 'beta', |
|
186 | + 'stable', |
|
187 | + 'production', |
|
188 | + ]; |
|
189 | + |
|
190 | + $this->appConfig |
|
191 | + ->expects($this->once()) |
|
192 | + ->method('getValueInt') |
|
193 | + ->with('core', 'lastupdatedat', 0) |
|
194 | + ->willReturn(12345); |
|
195 | + $this->config |
|
196 | + ->expects(self::any()) |
|
197 | + ->method('getSystemValueBool') |
|
198 | + ->with('updatechecker', true) |
|
199 | + ->willReturn(true); |
|
200 | + $this->appConfig |
|
201 | + ->expects($this->once()) |
|
202 | + ->method('getValueArray') |
|
203 | + ->with(Application::APP_NAME, 'notify_groups', ['admin']) |
|
204 | + ->willReturn(['admin']); |
|
205 | + $this->config |
|
206 | + ->method('getSystemValue') |
|
207 | + ->willReturnMap([ |
|
208 | + ['updater.server.url', 'https://updates.nextcloud.com/updater_server/', 'https://updates.nextcloud.com/updater_server_changed/'], |
|
209 | + ['upgrade.disable-web', false, true], |
|
210 | + ]); |
|
211 | + $this->dateTimeFormatter |
|
212 | + ->expects($this->once()) |
|
213 | + ->method('formatDateTime') |
|
214 | + ->with('12345') |
|
215 | + ->willReturn('LastCheckedReturnValue'); |
|
216 | + $this->updateChecker |
|
217 | + ->expects($this->once()) |
|
218 | + ->method('getUpdateState') |
|
219 | + ->willReturn([ |
|
220 | + 'updateAvailable' => true, |
|
221 | + 'updateVersion' => '8.1.2', |
|
222 | + 'updateVersionString' => 'Nextcloud 8.1.2', |
|
223 | + 'downloadLink' => 'https://downloads.nextcloud.org/server', |
|
224 | + 'changes' => [], |
|
225 | + 'updaterEnabled' => true, |
|
226 | + 'versionIsEol' => false, |
|
227 | + ]); |
|
228 | + |
|
229 | + $group = $this->createMock(IGroup::class); |
|
230 | + $group->expects($this->any()) |
|
231 | + ->method('getDisplayName') |
|
232 | + ->willReturn('Administrators'); |
|
233 | + $group->expects($this->any()) |
|
234 | + ->method('getGID') |
|
235 | + ->willReturn('admin'); |
|
236 | + $this->groupManager->expects($this->once()) |
|
237 | + ->method('get') |
|
238 | + ->with('admin') |
|
239 | + ->willReturn($group); |
|
240 | + |
|
241 | + $this->subscriptionRegistry |
|
242 | + ->expects($this->once()) |
|
243 | + ->method('delegateHasValidSubscription') |
|
244 | + ->willReturn(true); |
|
245 | + |
|
246 | + $this->initialState->expects($this->once()) |
|
247 | + ->method('provideInitialState') |
|
248 | + ->with('data', [ |
|
249 | + 'isNewVersionAvailable' => true, |
|
250 | + 'isUpdateChecked' => true, |
|
251 | + 'lastChecked' => 'LastCheckedReturnValue', |
|
252 | + 'currentChannel' => 'beta', |
|
253 | + 'channels' => $channels, |
|
254 | + 'newVersion' => '8.1.2', |
|
255 | + 'newVersionString' => 'Nextcloud 8.1.2', |
|
256 | + 'downloadLink' => 'https://downloads.nextcloud.org/server', |
|
257 | + 'changes' => [], |
|
258 | + 'webUpdaterEnabled' => false, |
|
259 | + 'isWebUpdaterRecommended' => true, |
|
260 | + 'updaterEnabled' => true, |
|
261 | + 'versionIsEol' => false, |
|
262 | + 'isDefaultUpdateServerURL' => false, |
|
263 | + 'updateServerURL' => 'https://updates.nextcloud.com/updater_server_changed/', |
|
264 | + 'notifyGroups' => [ |
|
265 | + ['id' => 'admin', 'displayname' => 'Administrators'], |
|
266 | + ], |
|
267 | + 'hasValidSubscription' => true, |
|
268 | + ]); |
|
269 | + |
|
270 | + $expected = new TemplateResponse(Application::APP_NAME, 'admin', [], ''); |
|
271 | + $this->assertEquals($expected, $this->admin->getForm()); |
|
272 | + } |
|
273 | + |
|
274 | + public function testGetFormWithUpdateAndCustomersUpdateServer(): void { |
|
275 | + $this->serverVersion->expects(self::atLeastOnce()) |
|
276 | + ->method('getChannel') |
|
277 | + ->willReturn('production'); |
|
278 | + $this->userManager |
|
279 | + ->expects($this->once()) |
|
280 | + ->method('countUsersTotal') |
|
281 | + ->willReturn(5); |
|
282 | + $channels = [ |
|
283 | + 'daily', |
|
284 | + 'beta', |
|
285 | + 'stable', |
|
286 | + 'production', |
|
287 | + ]; |
|
288 | + |
|
289 | + $this->appConfig |
|
290 | + ->expects($this->once()) |
|
291 | + ->method('getValueInt') |
|
292 | + ->with('core', 'lastupdatedat', 0) |
|
293 | + ->willReturn(12345); |
|
294 | + $this->config |
|
295 | + ->expects(self::any()) |
|
296 | + ->method('getSystemValueBool') |
|
297 | + ->with('updatechecker', true) |
|
298 | + ->willReturn(true); |
|
299 | + $this->appConfig |
|
300 | + ->expects(self::once()) |
|
301 | + ->method('getValueArray') |
|
302 | + ->with(Application::APP_NAME, 'notify_groups', ['admin']) |
|
303 | + ->willReturn(['admin']); |
|
304 | + $this->config |
|
305 | + ->method('getSystemValue') |
|
306 | + ->willReturnMap([ |
|
307 | + ['updater.server.url', 'https://updates.nextcloud.com/updater_server/', 'https://updates.nextcloud.com/customers/ABC-DEF/'], |
|
308 | + ['upgrade.disable-web', false, false], |
|
309 | + ]); |
|
310 | + $this->dateTimeFormatter |
|
311 | + ->expects($this->once()) |
|
312 | + ->method('formatDateTime') |
|
313 | + ->with('12345') |
|
314 | + ->willReturn('LastCheckedReturnValue'); |
|
315 | + $this->updateChecker |
|
316 | + ->expects($this->once()) |
|
317 | + ->method('getUpdateState') |
|
318 | + ->willReturn([ |
|
319 | + 'updateAvailable' => true, |
|
320 | + 'updateVersion' => '8.1.2', |
|
321 | + 'updateVersionString' => 'Nextcloud 8.1.2', |
|
322 | + 'downloadLink' => 'https://downloads.nextcloud.org/server', |
|
323 | + 'changes' => [], |
|
324 | + 'updaterEnabled' => true, |
|
325 | + 'versionIsEol' => false, |
|
326 | + ]); |
|
327 | + |
|
328 | + $group = $this->createMock(IGroup::class); |
|
329 | + $group->expects($this->any()) |
|
330 | + ->method('getDisplayName') |
|
331 | + ->willReturn('Administrators'); |
|
332 | + $group->expects($this->any()) |
|
333 | + ->method('getGID') |
|
334 | + ->willReturn('admin'); |
|
335 | + $this->groupManager->expects($this->once()) |
|
336 | + ->method('get') |
|
337 | + ->with('admin') |
|
338 | + ->willReturn($group); |
|
339 | + |
|
340 | + $this->subscriptionRegistry |
|
341 | + ->expects($this->once()) |
|
342 | + ->method('delegateHasValidSubscription') |
|
343 | + ->willReturn(true); |
|
344 | + |
|
345 | + $this->initialState->expects($this->once()) |
|
346 | + ->method('provideInitialState') |
|
347 | + ->with('data', [ |
|
348 | + 'isNewVersionAvailable' => true, |
|
349 | + 'isUpdateChecked' => true, |
|
350 | + 'lastChecked' => 'LastCheckedReturnValue', |
|
351 | + 'currentChannel' => 'production', |
|
352 | + 'channels' => $channels, |
|
353 | + 'newVersion' => '8.1.2', |
|
354 | + 'newVersionString' => 'Nextcloud 8.1.2', |
|
355 | + 'downloadLink' => 'https://downloads.nextcloud.org/server', |
|
356 | + 'changes' => [], |
|
357 | + 'webUpdaterEnabled' => true, |
|
358 | + 'isWebUpdaterRecommended' => true, |
|
359 | + 'updaterEnabled' => true, |
|
360 | + 'versionIsEol' => false, |
|
361 | + 'isDefaultUpdateServerURL' => true, |
|
362 | + 'updateServerURL' => 'https://updates.nextcloud.com/customers/ABC-DEF/', |
|
363 | + 'notifyGroups' => [ |
|
364 | + ['id' => 'admin', 'displayname' => 'Administrators'], |
|
365 | + ], |
|
366 | + 'hasValidSubscription' => true, |
|
367 | + ]); |
|
368 | + |
|
369 | + $expected = new TemplateResponse(Application::APP_NAME, 'admin', [], ''); |
|
370 | + $this->assertEquals($expected, $this->admin->getForm()); |
|
371 | + } |
|
372 | + |
|
373 | + |
|
374 | + public function testGetSection(): void { |
|
375 | + $this->config |
|
376 | + ->expects(self::atLeastOnce()) |
|
377 | + ->method('getSystemValueBool') |
|
378 | + ->with('updatechecker', true) |
|
379 | + ->willReturn(true); |
|
380 | + |
|
381 | + $this->assertSame('overview', $this->admin->getSection()); |
|
382 | + } |
|
383 | + |
|
384 | + public function testGetSectionDisabled(): void { |
|
385 | + $this->config |
|
386 | + ->expects(self::atLeastOnce()) |
|
387 | + ->method('getSystemValueBool') |
|
388 | + ->with('updatechecker', true) |
|
389 | + ->willReturn(false); |
|
390 | + |
|
391 | + $this->assertNull($this->admin->getSection()); |
|
392 | + } |
|
393 | + |
|
394 | + public function testGetPriority(): void { |
|
395 | + $this->assertSame(11, $this->admin->getPriority()); |
|
396 | + } |
|
397 | + |
|
398 | + public function changesProvider() { |
|
399 | + return [ |
|
400 | + [ #0, all info, en |
|
401 | + [ |
|
402 | + 'changelogURL' => 'https://go.to.changelog', |
|
403 | + 'whatsNew' => [ |
|
404 | + 'en' => [ |
|
405 | + 'regular' => ['content'], |
|
406 | + ], |
|
407 | + 'de' => [ |
|
408 | + 'regular' => ['inhalt'], |
|
409 | + ] |
|
410 | + ], |
|
411 | + ], |
|
412 | + 'en', |
|
413 | + [ |
|
414 | + 'changelogURL' => 'https://go.to.changelog', |
|
415 | + 'whatsNew' => [ |
|
416 | + 'regular' => ['content'], |
|
417 | + ], |
|
418 | + ] |
|
419 | + ], |
|
420 | + [ #1, all info, de |
|
421 | + [ |
|
422 | + 'changelogURL' => 'https://go.to.changelog', |
|
423 | + 'whatsNew' => [ |
|
424 | + 'en' => [ |
|
425 | + 'regular' => ['content'], |
|
426 | + ], |
|
427 | + 'de' => [ |
|
428 | + 'regular' => ['inhalt'], |
|
429 | + ] |
|
430 | + ], |
|
431 | + ], |
|
432 | + 'de', |
|
433 | + [ |
|
434 | + 'changelogURL' => 'https://go.to.changelog', |
|
435 | + 'whatsNew' => [ |
|
436 | + 'regular' => ['inhalt'], |
|
437 | + ] |
|
438 | + ], |
|
439 | + ], |
|
440 | + [ #2, just changelog |
|
441 | + [ 'changelogURL' => 'https://go.to.changelog' ], |
|
442 | + 'en', |
|
443 | + [ 'changelogURL' => 'https://go.to.changelog' ], |
|
444 | + ], |
|
445 | + [ #3 nothing |
|
446 | + [], |
|
447 | + 'ru', |
|
448 | + [] |
|
449 | + ] |
|
450 | + ]; |
|
451 | + } |
|
452 | + |
|
453 | + /** |
|
454 | + * @dataProvider changesProvider |
|
455 | + */ |
|
456 | + public function testFilterChanges($changes, $userLang, $expectation): void { |
|
457 | + $iterator = $this->createMock(ILanguageIterator::class); |
|
458 | + $iterator->expects($this->any()) |
|
459 | + ->method('current') |
|
460 | + ->willReturnOnConsecutiveCalls('es', $userLang, 'it', 'en'); |
|
461 | + $iterator->expects($this->any()) |
|
462 | + ->method('valid') |
|
463 | + ->willReturn(true); |
|
464 | + |
|
465 | + $this->l10nFactory->expects($this->atMost(1)) |
|
466 | + ->method('getLanguageIterator') |
|
467 | + ->willReturn($iterator); |
|
468 | + $result = $this->invokePrivate($this->admin, 'filterChanges', [$changes]); |
|
469 | + $this->assertSame($expectation, $result); |
|
470 | + } |
|
471 | 471 | } |
@@ -25,91 +25,91 @@ |
||
25 | 25 | |
26 | 26 | class NotifierTest extends TestCase { |
27 | 27 | |
28 | - protected IURLGenerator&MockObject $urlGenerator; |
|
29 | - protected IAppConfig&MockObject $appConfig; |
|
30 | - protected IManager&MockObject $notificationManager; |
|
31 | - protected IFactory&MockObject $l10nFactory; |
|
32 | - protected IUserSession&MockObject $userSession; |
|
33 | - protected IGroupManager&MockObject $groupManager; |
|
34 | - protected IAppManager&MockObject $appManager; |
|
35 | - protected ServerVersion&MockObject $serverVersion; |
|
28 | + protected IURLGenerator&MockObject $urlGenerator; |
|
29 | + protected IAppConfig&MockObject $appConfig; |
|
30 | + protected IManager&MockObject $notificationManager; |
|
31 | + protected IFactory&MockObject $l10nFactory; |
|
32 | + protected IUserSession&MockObject $userSession; |
|
33 | + protected IGroupManager&MockObject $groupManager; |
|
34 | + protected IAppManager&MockObject $appManager; |
|
35 | + protected ServerVersion&MockObject $serverVersion; |
|
36 | 36 | |
37 | - protected function setUp(): void { |
|
38 | - parent::setUp(); |
|
37 | + protected function setUp(): void { |
|
38 | + parent::setUp(); |
|
39 | 39 | |
40 | - $this->urlGenerator = $this->createMock(IURLGenerator::class); |
|
41 | - $this->appConfig = $this->createMock(IAppConfig::class); |
|
42 | - $this->notificationManager = $this->createMock(IManager::class); |
|
43 | - $this->l10nFactory = $this->createMock(IFactory::class); |
|
44 | - $this->userSession = $this->createMock(IUserSession::class); |
|
45 | - $this->groupManager = $this->createMock(IGroupManager::class); |
|
46 | - $this->appManager = $this->createMock(IAppManager::class); |
|
47 | - $this->serverVersion = $this->createMock(ServerVersion::class); |
|
48 | - } |
|
40 | + $this->urlGenerator = $this->createMock(IURLGenerator::class); |
|
41 | + $this->appConfig = $this->createMock(IAppConfig::class); |
|
42 | + $this->notificationManager = $this->createMock(IManager::class); |
|
43 | + $this->l10nFactory = $this->createMock(IFactory::class); |
|
44 | + $this->userSession = $this->createMock(IUserSession::class); |
|
45 | + $this->groupManager = $this->createMock(IGroupManager::class); |
|
46 | + $this->appManager = $this->createMock(IAppManager::class); |
|
47 | + $this->serverVersion = $this->createMock(ServerVersion::class); |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * @param array $methods |
|
52 | - * @return Notifier|\PHPUnit\Framework\MockObject\MockObject |
|
53 | - */ |
|
54 | - protected function getNotifier(array $methods = []) { |
|
55 | - if (empty($methods)) { |
|
56 | - return new Notifier( |
|
57 | - $this->urlGenerator, |
|
58 | - $this->appConfig, |
|
59 | - $this->notificationManager, |
|
60 | - $this->l10nFactory, |
|
61 | - $this->userSession, |
|
62 | - $this->groupManager, |
|
63 | - $this->appManager, |
|
64 | - $this->serverVersion, |
|
65 | - ); |
|
66 | - } |
|
67 | - { |
|
68 | - return $this->getMockBuilder(Notifier::class) |
|
69 | - ->setConstructorArgs([ |
|
70 | - $this->urlGenerator, |
|
71 | - $this->appConfig, |
|
72 | - $this->notificationManager, |
|
73 | - $this->l10nFactory, |
|
74 | - $this->userSession, |
|
75 | - $this->groupManager, |
|
76 | - $this->appManager, |
|
77 | - $this->serverVersion, |
|
78 | - ]) |
|
79 | - ->onlyMethods($methods) |
|
80 | - ->getMock(); |
|
81 | - } |
|
82 | - } |
|
50 | + /** |
|
51 | + * @param array $methods |
|
52 | + * @return Notifier|\PHPUnit\Framework\MockObject\MockObject |
|
53 | + */ |
|
54 | + protected function getNotifier(array $methods = []) { |
|
55 | + if (empty($methods)) { |
|
56 | + return new Notifier( |
|
57 | + $this->urlGenerator, |
|
58 | + $this->appConfig, |
|
59 | + $this->notificationManager, |
|
60 | + $this->l10nFactory, |
|
61 | + $this->userSession, |
|
62 | + $this->groupManager, |
|
63 | + $this->appManager, |
|
64 | + $this->serverVersion, |
|
65 | + ); |
|
66 | + } |
|
67 | + { |
|
68 | + return $this->getMockBuilder(Notifier::class) |
|
69 | + ->setConstructorArgs([ |
|
70 | + $this->urlGenerator, |
|
71 | + $this->appConfig, |
|
72 | + $this->notificationManager, |
|
73 | + $this->l10nFactory, |
|
74 | + $this->userSession, |
|
75 | + $this->groupManager, |
|
76 | + $this->appManager, |
|
77 | + $this->serverVersion, |
|
78 | + ]) |
|
79 | + ->onlyMethods($methods) |
|
80 | + ->getMock(); |
|
81 | + } |
|
82 | + } |
|
83 | 83 | |
84 | - public function dataUpdateAlreadyInstalledCheck(): array { |
|
85 | - return [ |
|
86 | - ['1.1.0', '1.0.0', false], |
|
87 | - ['1.1.0', '1.1.0', true], |
|
88 | - ['1.1.0', '1.2.0', true], |
|
89 | - ]; |
|
90 | - } |
|
84 | + public function dataUpdateAlreadyInstalledCheck(): array { |
|
85 | + return [ |
|
86 | + ['1.1.0', '1.0.0', false], |
|
87 | + ['1.1.0', '1.1.0', true], |
|
88 | + ['1.1.0', '1.2.0', true], |
|
89 | + ]; |
|
90 | + } |
|
91 | 91 | |
92 | - /** |
|
93 | - * @dataProvider dataUpdateAlreadyInstalledCheck |
|
94 | - * |
|
95 | - * @param string $versionNotification |
|
96 | - * @param string $versionInstalled |
|
97 | - * @param bool $exception |
|
98 | - */ |
|
99 | - public function testUpdateAlreadyInstalledCheck(string $versionNotification, string $versionInstalled, bool $exception): void { |
|
100 | - $notifier = $this->getNotifier(); |
|
92 | + /** |
|
93 | + * @dataProvider dataUpdateAlreadyInstalledCheck |
|
94 | + * |
|
95 | + * @param string $versionNotification |
|
96 | + * @param string $versionInstalled |
|
97 | + * @param bool $exception |
|
98 | + */ |
|
99 | + public function testUpdateAlreadyInstalledCheck(string $versionNotification, string $versionInstalled, bool $exception): void { |
|
100 | + $notifier = $this->getNotifier(); |
|
101 | 101 | |
102 | - $notification = $this->createMock(INotification::class); |
|
103 | - $notification->expects($this->once()) |
|
104 | - ->method('getObjectId') |
|
105 | - ->willReturn($versionNotification); |
|
102 | + $notification = $this->createMock(INotification::class); |
|
103 | + $notification->expects($this->once()) |
|
104 | + ->method('getObjectId') |
|
105 | + ->willReturn($versionNotification); |
|
106 | 106 | |
107 | - try { |
|
108 | - self::invokePrivate($notifier, 'updateAlreadyInstalledCheck', [$notification, $versionInstalled]); |
|
109 | - $this->assertFalse($exception); |
|
110 | - } catch (\Exception $e) { |
|
111 | - $this->assertTrue($exception); |
|
112 | - $this->assertInstanceOf(AlreadyProcessedException::class, $e); |
|
113 | - } |
|
114 | - } |
|
107 | + try { |
|
108 | + self::invokePrivate($notifier, 'updateAlreadyInstalledCheck', [$notification, $versionInstalled]); |
|
109 | + $this->assertFalse($exception); |
|
110 | + } catch (\Exception $e) { |
|
111 | + $this->assertTrue($exception); |
|
112 | + $this->assertInstanceOf(AlreadyProcessedException::class, $e); |
|
113 | + } |
|
114 | + } |
|
115 | 115 | } |