diff options
author | Louis Chemineau <louis@chmn.me> | 2025-03-26 21:01:47 +0100 |
---|---|---|
committer | Andy Scherzinger <info@andy-scherzinger.de> | 2025-03-30 08:54:41 +0200 |
commit | bd9a2eba760af44c4308e5b907b55ed6bdf8e77a (patch) | |
tree | 398d789c6f82ea4c828c3565c87d3a30b894a9b4 /apps/files_trashbin/tests | |
parent | 22e02d1c1e7534ab2b91d2cc3f88cb6a0f7c3495 (diff) | |
download | nextcloud-server-bd9a2eba760af44c4308e5b907b55ed6bdf8e77a.tar.gz nextcloud-server-bd9a2eba760af44c4308e5b907b55ed6bdf8e77a.zip |
feat: Limit trash expire job to 30 minutesartonge/feat/allow_partial_seen_users
And pick up where it left off, leveraging getSeenUsers.
Signed-off-by: Louis Chemineau <louis@chmn.me>
Diffstat (limited to 'apps/files_trashbin/tests')
-rw-r--r-- | apps/files_trashbin/tests/BackgroundJob/ExpireTrashTest.php | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/apps/files_trashbin/tests/BackgroundJob/ExpireTrashTest.php b/apps/files_trashbin/tests/BackgroundJob/ExpireTrashTest.php index b172f1f2715..82977068983 100644 --- a/apps/files_trashbin/tests/BackgroundJob/ExpireTrashTest.php +++ b/apps/files_trashbin/tests/BackgroundJob/ExpireTrashTest.php @@ -11,31 +11,31 @@ use OCA\Files_Trashbin\BackgroundJob\ExpireTrash; use OCA\Files_Trashbin\Expiration; use OCP\AppFramework\Utility\ITimeFactory; use OCP\BackgroundJob\IJobList; -use OCP\IConfig; +use OCP\IAppConfig; use OCP\IUserManager; use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; class ExpireTrashTest extends TestCase { - /** @var IConfig|MockObject */ - private $config; + /** @var IAppConfig&MockObject */ + private $appConfig; - /** @var IUserManager|MockObject */ + /** @var IUserManager&MockObject */ private $userManager; - /** @var Expiration|MockObject */ + /** @var Expiration&MockObject */ private $expiration; - /** @var IJobList|MockObject */ + /** @var IJobList&MockObject */ private $jobList; - /** @var ITimeFactory|MockObject */ + /** @var ITimeFactory&MockObject */ private $time; protected function setUp(): void { parent::setUp(); - $this->config = $this->createMock(IConfig::class); + $this->appConfig = $this->createMock(IAppConfig::class); $this->userManager = $this->createMock(IUserManager::class); $this->expiration = $this->createMock(Expiration::class); $this->jobList = $this->createMock(IJobList::class); @@ -51,22 +51,25 @@ class ExpireTrashTest extends TestCase { } public function testConstructAndRun(): void { - $this->config->method('getAppValue') + $this->appConfig->method('getValueString') ->with('files_trashbin', 'background_job_expire_trash', 'yes') ->willReturn('yes'); + $this->appConfig->method('getValueInt') + ->with('files_trashbin', 'background_job_expire_trash_offset', 0) + ->willReturn(0); - $job = new ExpireTrash($this->config, $this->userManager, $this->expiration, $this->time); + $job = new ExpireTrash($this->appConfig, $this->userManager, $this->expiration, $this->time); $job->start($this->jobList); } public function testBackgroundJobDeactivated(): void { - $this->config->method('getAppValue') + $this->appConfig->method('getValueString') ->with('files_trashbin', 'background_job_expire_trash', 'yes') ->willReturn('no'); $this->expiration->expects($this->never()) ->method('getMaxAgeAsTimestamp'); - $job = new ExpireTrash($this->config, $this->userManager, $this->expiration, $this->time); + $job = new ExpireTrash($this->appConfig, $this->userManager, $this->expiration, $this->time); $job->start($this->jobList); } } |