2018-06-19 06:22:30 -04:00
|
|
|
<?php
|
2022-02-22 05:24:38 -05:00
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2018-06-19 06:22:30 -04:00
|
|
|
/**
|
2024-05-28 06:34:11 -04:00
|
|
|
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2018-06-19 06:22:30 -04:00
|
|
|
*/
|
|
|
|
|
namespace OCA\DAV\Tests\unit\BackgroundJob;
|
|
|
|
|
|
|
|
|
|
use OCA\DAV\BackgroundJob\UpdateCalendarResourcesRoomsBackgroundJob;
|
|
|
|
|
|
2022-02-22 05:24:38 -05:00
|
|
|
use OCP\AppFramework\Utility\ITimeFactory;
|
2018-06-19 06:22:30 -04:00
|
|
|
use OCP\Calendar\Resource\IManager as IResourceManager;
|
|
|
|
|
use OCP\Calendar\Room\IManager as IRoomManager;
|
2022-02-22 05:24:38 -05:00
|
|
|
use PHPUnit\Framework\MockObject\MockObject;
|
2018-06-19 06:22:30 -04:00
|
|
|
use Test\TestCase;
|
|
|
|
|
|
|
|
|
|
class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase {
|
2024-05-16 15:27:07 -04:00
|
|
|
private UpdateCalendarResourcesRoomsBackgroundJob $backgroundJob;
|
2018-06-19 06:22:30 -04:00
|
|
|
|
2022-02-22 05:24:38 -05:00
|
|
|
/** @var ITimeFactory|MockObject */
|
|
|
|
|
private $time;
|
2018-06-19 06:22:30 -04:00
|
|
|
|
2022-02-22 05:24:38 -05:00
|
|
|
/** @var IResourceManager|MockObject */
|
2018-06-19 06:22:30 -04:00
|
|
|
private $resourceManager;
|
|
|
|
|
|
2022-02-22 05:24:38 -05:00
|
|
|
/** @var IRoomManager|MockObject */
|
2018-06-19 06:22:30 -04:00
|
|
|
private $roomManager;
|
|
|
|
|
|
2019-11-21 10:40:38 -05:00
|
|
|
protected function setUp(): void {
|
2018-06-19 06:22:30 -04:00
|
|
|
parent::setUp();
|
|
|
|
|
|
2022-02-22 05:24:38 -05:00
|
|
|
$this->time = $this->createMock(ITimeFactory::class);
|
2018-06-19 06:22:30 -04:00
|
|
|
$this->resourceManager = $this->createMock(IResourceManager::class);
|
|
|
|
|
$this->roomManager = $this->createMock(IRoomManager::class);
|
|
|
|
|
|
|
|
|
|
$this->backgroundJob = new UpdateCalendarResourcesRoomsBackgroundJob(
|
2022-02-22 05:24:38 -05:00
|
|
|
$this->time,
|
|
|
|
|
$this->resourceManager,
|
|
|
|
|
$this->roomManager,
|
|
|
|
|
);
|
2018-06-19 06:22:30 -04:00
|
|
|
}
|
|
|
|
|
|
2023-01-20 02:38:43 -05:00
|
|
|
public function testRun(): void {
|
2024-05-16 15:27:07 -04:00
|
|
|
$this->resourceManager->expects(self::once())
|
|
|
|
|
->method('update');
|
|
|
|
|
$this->roomManager->expects(self::once())
|
|
|
|
|
->method('update');
|
2018-06-19 06:22:30 -04:00
|
|
|
|
|
|
|
|
$this->backgroundJob->run([]);
|
|
|
|
|
}
|
|
|
|
|
}
|