aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/tests/unit/BackgroundJob/RefreshWebcalJobTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dav/tests/unit/BackgroundJob/RefreshWebcalJobTest.php')
-rw-r--r--apps/dav/tests/unit/BackgroundJob/RefreshWebcalJobTest.php62
1 files changed, 14 insertions, 48 deletions
diff --git a/apps/dav/tests/unit/BackgroundJob/RefreshWebcalJobTest.php b/apps/dav/tests/unit/BackgroundJob/RefreshWebcalJobTest.php
index 360c4c791c7..7713ef2945a 100644
--- a/apps/dav/tests/unit/BackgroundJob/RefreshWebcalJobTest.php
+++ b/apps/dav/tests/unit/BackgroundJob/RefreshWebcalJobTest.php
@@ -3,28 +3,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2018, Georg Ehrke
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Georg Ehrke <oc.list@georgehrke.com>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- * @author Thomas Citharel <nextcloud@tcit.fr>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\DAV\Tests\unit\BackgroundJob;
@@ -33,34 +13,24 @@ use OCA\DAV\CalDAV\WebcalCaching\RefreshWebcalService;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJobList;
use OCP\IConfig;
-use OCP\ILogger;
use PHPUnit\Framework\MockObject\MockObject;
+use Psr\Log\LoggerInterface;
use Test\TestCase;
class RefreshWebcalJobTest extends TestCase {
-
- /** @var RefreshWebcalService | MockObject */
- private $refreshWebcalService;
-
- /** @var IConfig | MockObject */
- private $config;
-
- /** @var ILogger | MockObject */
- private $logger;
-
- /** @var ITimeFactory | MockObject */
- private $timeFactory;
-
- /** @var IJobList | MockObject */
- private $jobList;
+ private RefreshWebcalService&MockObject $refreshWebcalService;
+ private IConfig&MockObject $config;
+ private LoggerInterface $logger;
+ private ITimeFactory&MockObject $timeFactory;
+ private IJobList&MockObject $jobList;
protected function setUp(): void {
parent::setUp();
$this->refreshWebcalService = $this->createMock(RefreshWebcalService::class);
$this->config = $this->createMock(IConfig::class);
- $this->logger = $this->createMock(ILogger::class);
+ $this->logger = $this->createMock(LoggerInterface::class);
$this->timeFactory = $this->createMock(ITimeFactory::class);
$this->jobList = $this->createMock(IJobList::class);
@@ -71,10 +41,9 @@ class RefreshWebcalJobTest extends TestCase {
* @param int $lastRun
* @param int $time
* @param bool $process
- *
- * @dataProvider runDataProvider
*/
- public function testRun(int $lastRun, int $time, bool $process) {
+ #[\PHPUnit\Framework\Attributes\DataProvider('runDataProvider')]
+ public function testRun(int $lastRun, int $time, bool $process): void {
$backgroundJob = new RefreshWebcalJob($this->refreshWebcalService, $this->config, $this->logger, $this->timeFactory);
$backgroundJob->setId(42);
@@ -99,7 +68,7 @@ class RefreshWebcalJobTest extends TestCase {
$this->config->expects($this->once())
->method('getAppValue')
- ->with('dav', 'calendarSubscriptionRefreshRate', 'P1W')
+ ->with('dav', 'calendarSubscriptionRefreshRate', 'P1D')
->willReturn('P1W');
$this->timeFactory->method('getTime')
@@ -115,13 +84,10 @@ class RefreshWebcalJobTest extends TestCase {
->with('principals/users/testuser', 'sub123');
}
- $backgroundJob->execute($this->jobList, $this->logger);
+ $backgroundJob->start($this->jobList);
}
- /**
- * @return array
- */
- public function runDataProvider():array {
+ public static function runDataProvider():array {
return [
[0, 100000, true],
[100000, 100000, false]