diff options
author | Thomas Citharel <tcit@tcit.fr> | 2022-05-25 08:58:10 +0200 |
---|---|---|
committer | Thomas Citharel <tcit@tcit.fr> | 2022-06-15 10:29:16 +0200 |
commit | 956d895920107b9ae7bb2b4657f89c98a06c43b1 (patch) | |
tree | c63a1cb70c662340ca07f8dfb3429b1d5bb340ee | |
parent | 56727ba58b776732524a47ee42063653211fcd41 (diff) | |
download | nextcloud-server-956d895920107b9ae7bb2b4657f89c98a06c43b1.tar.gz nextcloud-server-956d895920107b9ae7bb2b4657f89c98a06c43b1.zip |
Update tests after ResetTokenBackgroundJob changes
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
-rw-r--r-- | apps/updatenotification/tests/ResetTokenBackgroundJobTest.php | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/apps/updatenotification/tests/ResetTokenBackgroundJobTest.php b/apps/updatenotification/tests/ResetTokenBackgroundJobTest.php index 129ba370980..56a82b5b726 100644 --- a/apps/updatenotification/tests/ResetTokenBackgroundJobTest.php +++ b/apps/updatenotification/tests/ResetTokenBackgroundJobTest.php @@ -57,6 +57,11 @@ class ResetTokenBackgroundJobTest extends TestCase { ->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]); + } } |