From: Christopher Ng Date: Fri, 11 Aug 2023 02:07:53 +0000 (-0700) Subject: test(updatenotification): No internet X-Git-Tag: v28.0.0beta1~559^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F39806%2Fhead;p=nextcloud-server.git test(updatenotification): No internet Signed-off-by: Christopher Ng --- diff --git a/apps/updatenotification/tests/Notification/BackgroundJobTest.php b/apps/updatenotification/tests/Notification/BackgroundJobTest.php index df8b104e9ca..d669a5832b4 100644 --- a/apps/updatenotification/tests/Notification/BackgroundJobTest.php +++ b/apps/updatenotification/tests/Notification/BackgroundJobTest.php @@ -112,9 +112,34 @@ class BackgroundJobTest extends TestCase { $job->expects($this->once()) ->method('checkAppUpdates'); + $this->config->expects($this->exactly(2)) + ->method('getSystemValueBool') + ->withConsecutive( + ['has_internet_connection', true], + ['debug', false], + ) + ->willReturnOnConsecutiveCalls( + true, + true, + ); + + self::invokePrivate($job, 'run', [null]); + } + + public function testRunNoInternet() { + $job = $this->getJob([ + 'checkCoreUpdate', + 'checkAppUpdates', + ]); + + $job->expects($this->never()) + ->method('checkCoreUpdate'); + $job->expects($this->never()) + ->method('checkAppUpdates'); + $this->config->method('getSystemValueBool') - ->with('debug', false) - ->willReturn(true); + ->with('has_internet_connection', true) + ->willReturn(false); self::invokePrivate($job, 'run', [null]); }