1
0

UpdateCalendarResourcesRoomsBackgroundJobTest.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCA\DAV\Tests\unit\BackgroundJob;
  8. use OCA\DAV\BackgroundJob\UpdateCalendarResourcesRoomsBackgroundJob;
  9. use OCP\AppFramework\Utility\ITimeFactory;
  10. use OCP\Calendar\Resource\IManager as IResourceManager;
  11. use OCP\Calendar\Room\IManager as IRoomManager;
  12. use PHPUnit\Framework\MockObject\MockObject;
  13. use Test\TestCase;
  14. class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase {
  15. private UpdateCalendarResourcesRoomsBackgroundJob $backgroundJob;
  16. /** @var ITimeFactory|MockObject */
  17. private $time;
  18. /** @var IResourceManager|MockObject */
  19. private $resourceManager;
  20. /** @var IRoomManager|MockObject */
  21. private $roomManager;
  22. protected function setUp(): void {
  23. parent::setUp();
  24. $this->time = $this->createMock(ITimeFactory::class);
  25. $this->resourceManager = $this->createMock(IResourceManager::class);
  26. $this->roomManager = $this->createMock(IRoomManager::class);
  27. $this->backgroundJob = new UpdateCalendarResourcesRoomsBackgroundJob(
  28. $this->time,
  29. $this->resourceManager,
  30. $this->roomManager,
  31. );
  32. }
  33. public function testRun(): void {
  34. $this->resourceManager->expects(self::once())
  35. ->method('update');
  36. $this->roomManager->expects(self::once())
  37. ->method('update');
  38. $this->backgroundJob->run([]);
  39. }
  40. }