]> source.dussan.org Git - nextcloud-server.git/commitdiff
test(updatenotification): No internet 39806/head
authorChristopher Ng <chrng8@gmail.com>
Fri, 11 Aug 2023 02:07:53 +0000 (19:07 -0700)
committerChristopher Ng <chrng8@gmail.com>
Fri, 11 Aug 2023 18:23:30 +0000 (11:23 -0700)
Signed-off-by: Christopher Ng <chrng8@gmail.com>
apps/updatenotification/tests/Notification/BackgroundJobTest.php

index df8b104e9ca87473796b146f5d8871be23306797..d669a5832b49423e78d3e420acee13f1b1fd35b5 100644 (file)
@@ -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]);
        }