aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorblizzz <blizzz@arthur-schiwon.de>2023-01-16 11:10:10 +0100
committerGitHub <noreply@github.com>2023-01-16 11:10:10 +0100
commitdbfe7b1816ee4d7756478d3abbe336a2cf3dbe57 (patch)
tree0b3ed4442f2cad09c47ba73dd752ddf09cb443dd /tests
parent5e090d044d3d660316450c3d4d2d7bfc3bde20dd (diff)
parentd74044f6341e93861d820f21b6d37a2f98e1ef60 (diff)
downloadnextcloud-server-dbfe7b1816ee4d7756478d3abbe336a2cf3dbe57.tar.gz
nextcloud-server-dbfe7b1816ee4d7756478d3abbe336a2cf3dbe57.zip
Merge pull request #36073 from nextcloud/fix/fix-background-job-list
Use a Generator for job list to fix background-job:list command
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/BackgroundJob/DummyJobList.php2
-rw-r--r--tests/lib/BackgroundJob/JobListTest.php7
2 files changed, 7 insertions, 2 deletions
diff --git a/tests/lib/BackgroundJob/DummyJobList.php b/tests/lib/BackgroundJob/DummyJobList.php
index 4d14ed9e7db..be48259789a 100644
--- a/tests/lib/BackgroundJob/DummyJobList.php
+++ b/tests/lib/BackgroundJob/DummyJobList.php
@@ -72,7 +72,7 @@ class DummyJobList extends \OC\BackgroundJob\JobList {
return $this->jobs;
}
- public function getJobs($job, ?int $limit, int $offset): array {
+ public function getJobsIterator($job, ?int $limit, int $offset): array {
if ($job instanceof IJob) {
$jobClass = get_class($job);
} else {
diff --git a/tests/lib/BackgroundJob/JobListTest.php b/tests/lib/BackgroundJob/JobListTest.php
index 736d670ed20..ea02e1cd8b9 100644
--- a/tests/lib/BackgroundJob/JobListTest.php
+++ b/tests/lib/BackgroundJob/JobListTest.php
@@ -54,7 +54,12 @@ class JobListTest extends TestCase {
}
protected function getAllSorted() {
- $jobs = $this->instance->getAll();
+ $iterator = $this->instance->getJobsIterator(null, null, 0);
+ $jobs = [];
+
+ foreach ($iterator as $job) {
+ $jobs[] = clone $job;
+ }
usort($jobs, function (IJob $job1, IJob $job2) {
return $job1->getId() - $job2->getId();