aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/BackgroundJob/QueuedJobTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/BackgroundJob/QueuedJobTest.php')
-rw-r--r--tests/lib/BackgroundJob/QueuedJobTest.php45
1 files changed, 12 insertions, 33 deletions
diff --git a/tests/lib/BackgroundJob/QueuedJobTest.php b/tests/lib/BackgroundJob/QueuedJobTest.php
index 9378816ce61..1c0946ff2f2 100644
--- a/tests/lib/BackgroundJob/QueuedJobTest.php
+++ b/tests/lib/BackgroundJob/QueuedJobTest.php
@@ -1,28 +1,19 @@
<?php
+
/**
- * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
+ * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace Test\BackgroundJob;
use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\BackgroundJob\QueuedJob;
+use OCP\Server;
-class TestQueuedJob extends \OC\BackgroundJob\QueuedJob {
- public $ran = false;
-
-
- public function run($argument) {
- $this->ran = true;
- }
-}
-
-
-class TestQueuedJobNew extends \OCP\BackgroundJob\QueuedJob {
- public $ran = false;
-
+class TestQueuedJobNew extends QueuedJob {
+ public bool $ran = false;
public function run($argument) {
$this->ran = true;
@@ -30,10 +21,7 @@ class TestQueuedJobNew extends \OCP\BackgroundJob\QueuedJob {
}
class QueuedJobTest extends \Test\TestCase {
- /**
- * @var DummyJobList $jobList
- */
- private $jobList;
+ private DummyJobList $jobList;
protected function setUp(): void {
parent::setUp();
@@ -41,22 +29,13 @@ class QueuedJobTest extends \Test\TestCase {
$this->jobList = new DummyJobList();
}
- public function testJobShouldBeRemoved() {
- $job = new TestQueuedJob();
- $this->jobList->add($job);
-
- $this->assertTrue($this->jobList->has($job, null));
- $job->execute($this->jobList);
- $this->assertTrue($job->ran);
- }
-
- public function testJobShouldBeRemovedNew() {
- $job = new TestQueuedJobNew(\OC::$server->query(ITimeFactory::class));
+ public function testJobShouldBeRemovedNew(): void {
+ $job = new TestQueuedJobNew(Server::get(ITimeFactory::class));
$job->setId(42);
$this->jobList->add($job);
$this->assertTrue($this->jobList->has($job, null));
- $job->execute($this->jobList);
+ $job->start($this->jobList);
$this->assertTrue($job->ran);
}
}