]> source.dussan.org Git - nextcloud-server.git/commitdiff
Update tests after ResetTokenBackgroundJob changes 32584/head
authorThomas Citharel <tcit@tcit.fr>
Wed, 25 May 2022 06:58:10 +0000 (08:58 +0200)
committerThomas Citharel <tcit@tcit.fr>
Wed, 15 Jun 2022 08:29:16 +0000 (10:29 +0200)
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
apps/updatenotification/tests/ResetTokenBackgroundJobTest.php

index 129ba37098063e71815a1c58ad30aee954db9fbd..56a82b5b726abe136a815f333f5705f604f02718 100644 (file)
@@ -56,6 +56,11 @@ class ResetTokenBackgroundJobTest extends TestCase {
                        ->expects($this->once())
                        ->method('getAppValue')
                        ->with('core', 'updater.secret.created', 123);
+               $this->config
+                       ->expects($this->once())
+                       ->method('getSystemValueBool')
+                       ->with('config_is_read_only')
+                       ->willReturn(false);
                $this->config
                        ->expects($this->never())
                        ->method('deleteSystemValue');
@@ -65,13 +70,9 @@ class ResetTokenBackgroundJobTest extends TestCase {
 
        public function testRunWithExpiredToken() {
                $this->timeFactory
-                       ->expects($this->at(0))
+                       ->expects($this->exactly(2))
                        ->method('getTime')
-                       ->willReturn(1455131633);
-               $this->timeFactory
-                       ->expects($this->at(1))
-                       ->method('getTime')
-                       ->willReturn(1455045234);
+                       ->willReturnOnConsecutiveCalls(1455131633, 1455045234);
                $this->config
                        ->expects($this->once())
                        ->method('getAppValue')
@@ -83,4 +84,23 @@ class ResetTokenBackgroundJobTest extends TestCase {
 
                static::invokePrivate($this->resetTokenBackgroundJob, 'run', [null]);
        }
+
+       public function testRunWithExpiredTokenAndReadOnlyConfigFile() {
+               $this->timeFactory
+                       ->expects($this->never())
+                       ->method('getTime');
+               $this->config
+                       ->expects($this->never())
+                       ->method('getAppValue');
+               $this->config
+                       ->expects($this->once())
+                       ->method('getSystemValueBool')
+                       ->with('config_is_read_only')
+                       ->willReturn(true);
+               $this->config
+                       ->expects($this->never())
+                       ->method('deleteSystemValue');
+
+               static::invokePrivate($this->resetTokenBackgroundJob, 'run', [null]);
+       }
 }