diff options
Diffstat (limited to 'tests/lib/BackgroundJob/TimedJobTest.php')
-rw-r--r-- | tests/lib/BackgroundJob/TimedJobTest.php | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/tests/lib/BackgroundJob/TimedJobTest.php b/tests/lib/BackgroundJob/TimedJobTest.php index 0ae245d1ff8..d56240eb75e 100644 --- a/tests/lib/BackgroundJob/TimedJobTest.php +++ b/tests/lib/BackgroundJob/TimedJobTest.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2018-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -8,20 +9,7 @@ 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; @@ -31,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); @@ -44,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); @@ -54,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); |