0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-05-22 22:10:09 +00:00
nextcloud_server/apps/user_status/tests/Unit/BackgroundJob/ClearOldStatusesBackgroundJobTest.php
Joas Schilling ea0229dc86
test: Fix some apps/*/tests
Signed-off-by: Joas Schilling <coding@schilljs.com>
2025-05-15 08:26:15 +02:00

44 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\UserStatus\Tests\BackgroundJob;
use OCA\UserStatus\BackgroundJob\ClearOldStatusesBackgroundJob;
use OCA\UserStatus\Db\UserStatusMapper;
use OCP\AppFramework\Utility\ITimeFactory;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
class ClearOldStatusesBackgroundJobTest extends TestCase {
private ITimeFactory&MockObject $time;
private UserStatusMapper&MockObject $mapper;
private ClearOldStatusesBackgroundJob $job;
protected function setUp(): void {
parent::setUp();
$this->time = $this->createMock(ITimeFactory::class);
$this->mapper = $this->createMock(UserStatusMapper::class);
$this->job = new ClearOldStatusesBackgroundJob($this->time, $this->mapper);
}
public function testRun(): void {
$this->mapper->expects($this->once())
->method('clearOlderThanClearAt')
->with(1337);
$this->mapper->expects($this->once())
->method('clearStatusesOlderThan')
->with(437, 1337);
$this->time->method('getTime')
->willReturn(1337);
self::invokePrivate($this->job, 'run', [[]]);
}
}