Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update tests after ResetTokenBackgroundJob changes
Signed-off-by: Thomas Citharel <[email protected]>
  • Loading branch information
tcitworld authored and backportbot-nextcloud[bot] committed Jun 15, 2022
commit 9d7729df3b4e1dacfa3c11aa6b9098fc7d584e5d
32 changes: 26 additions & 6 deletions apps/updatenotification/tests/ResetTokenBackgroundJobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ public function testRunWithNotExpiredToken() {
->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');
Expand All @@ -65,13 +70,9 @@ public function testRunWithNotExpiredToken() {

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')
Expand All @@ -83,4 +84,23 @@ public function testRunWithExpiredToken() {

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]);
}
}