summaryrefslogtreecommitdiffstats
path: root/apps/dav
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2020-11-24 14:18:47 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2020-11-25 15:03:06 +0100
commit6166e1a157774b7c3c1ee8f304ef96ff2efe3e92 (patch)
tree4edbc6ae63ec8bd1d0982978524f0137e21ab6e2 /apps/dav
parentd4fd61b7c6df367899fc225784d3cea64206a542 (diff)
downloadnextcloud-server-6166e1a157774b7c3c1ee8f304ef96ff2efe3e92.tar.gz
nextcloud-server-6166e1a157774b7c3c1ee8f304ef96ff2efe3e92.zip
Use proper OCP\BackgroundJobs\Job
And typehunt the IJobList Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/dav')
-rw-r--r--apps/dav/lib/BackgroundJob/RefreshWebcalJob.php6
-rw-r--r--apps/dav/tests/unit/BackgroundJob/RefreshWebcalJobTest.php4
2 files changed, 6 insertions, 4 deletions
diff --git a/apps/dav/lib/BackgroundJob/RefreshWebcalJob.php b/apps/dav/lib/BackgroundJob/RefreshWebcalJob.php
index 47dbbcbcaa1..32a48919868 100644
--- a/apps/dav/lib/BackgroundJob/RefreshWebcalJob.php
+++ b/apps/dav/lib/BackgroundJob/RefreshWebcalJob.php
@@ -30,9 +30,10 @@ declare(strict_types=1);
namespace OCA\DAV\BackgroundJob;
use DateInterval;
-use OC\BackgroundJob\Job;
use OCA\DAV\CalDAV\WebcalCaching\RefreshWebcalService;
use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\BackgroundJob\IJobList;
+use OCP\BackgroundJob\Job;
use OCP\IConfig;
use OCP\ILogger;
use Sabre\VObject\DateTimeParser;
@@ -65,6 +66,7 @@ class RefreshWebcalJob extends Job {
* @param ITimeFactory $timeFactory
*/
public function __construct(RefreshWebcalService $refreshWebcalService, IConfig $config, ILogger $logger, ITimeFactory $timeFactory) {
+ parent::__construct($timeFactory);
$this->refreshWebcalService = $refreshWebcalService;
$this->config = $config;
$this->logger = $logger;
@@ -76,7 +78,7 @@ class RefreshWebcalJob extends Job {
*
* @inheritdoc
*/
- public function execute($jobList, ILogger $logger = null) {
+ public function execute(IJobList $jobList, ILogger $logger = null) {
$subscription = $this->refreshWebcalService->getSubscription($this->argument['principaluri'], $this->argument['uri']);
if (!$subscription) {
return;
diff --git a/apps/dav/tests/unit/BackgroundJob/RefreshWebcalJobTest.php b/apps/dav/tests/unit/BackgroundJob/RefreshWebcalJobTest.php
index f65675bccb3..c4cb52370ae 100644
--- a/apps/dav/tests/unit/BackgroundJob/RefreshWebcalJobTest.php
+++ b/apps/dav/tests/unit/BackgroundJob/RefreshWebcalJobTest.php
@@ -74,6 +74,7 @@ class RefreshWebcalJobTest extends TestCase {
*/
public function testRun(int $lastRun, int $time, bool $process) {
$backgroundJob = new RefreshWebcalJob($this->refreshWebcalService, $this->config, $this->logger, $this->timeFactory);
+ $backgroundJob->setId(42);
$backgroundJob->setArgument([
'principaluri' => 'principals/users/testuser',
@@ -99,8 +100,7 @@ class RefreshWebcalJobTest extends TestCase {
->with('dav', 'calendarSubscriptionRefreshRate', 'P1W')
->willReturn('P1W');
- $this->timeFactory->expects($this->once())
- ->method('getTime')
+ $this->timeFactory->method('getTime')
->willReturn($time);
if ($process) {