diff options
Diffstat (limited to 'tests/lib/BackgroundJob/TimedJobTest.php')
-rw-r--r-- | tests/lib/BackgroundJob/TimedJobTest.php | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/tests/lib/BackgroundJob/TimedJobTest.php b/tests/lib/BackgroundJob/TimedJobTest.php index d0dd794a77c..d56240eb75e 100644 --- a/tests/lib/BackgroundJob/TimedJobTest.php +++ b/tests/lib/BackgroundJob/TimedJobTest.php @@ -1,28 +1,15 @@ <?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\TimedJob; - -class TestTimedJobNew extends TimedJob { - public bool $ran = false; - - public function __construct(ITimeFactory $timeFactory) { - parent::__construct($timeFactory); - $this->setInterval(10); - } - - public function run($argument) { - $this->ran = true; - } -} +use OCP\Server; class TimedJobTest extends \Test\TestCase { private DummyJobList $jobList; @@ -32,10 +19,10 @@ class TimedJobTest extends \Test\TestCase { parent::setUp(); $this->jobList = new DummyJobList(); - $this->time = \OCP\Server::get(ITimeFactory::class); + $this->time = Server::get(ITimeFactory::class); } - public function testShouldRunAfterIntervalNew() { + public function testShouldRunAfterIntervalNew(): void { $job = new TestTimedJobNew($this->time); $job->setId(42); $this->jobList->add($job); @@ -45,7 +32,7 @@ class TimedJobTest extends \Test\TestCase { $this->assertTrue($job->ran); } - public function testShouldNotRunWithinIntervalNew() { + public function testShouldNotRunWithinIntervalNew(): void { $job = new TestTimedJobNew($this->time); $job->setId(42); $this->jobList->add($job); @@ -55,7 +42,7 @@ class TimedJobTest extends \Test\TestCase { $this->assertFalse($job->ran); } - public function testShouldNotTwiceNew() { + public function testShouldNotTwiceNew(): void { $job = new TestTimedJobNew($this->time); $job->setId(42); $this->jobList->add($job); |