summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-08-19 14:16:05 +0200
committerRobin Appelman <icewind@owncloud.com>2015-08-19 14:16:05 +0200
commitbeaef820cf67d96652cd0774b151061d7ecd963a (patch)
tree21a069f82784c53d89930029d5bbe568695e8420 /tests
parent74237a9c44192fb98944ea7f3c14fa6f22c0814b (diff)
downloadnextcloud-server-beaef820cf67d96652cd0774b151061d7ecd963a.tar.gz
nextcloud-server-beaef820cf67d96652cd0774b151061d7ecd963a.zip
handle non existing job classes in $jobList->getNext
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/backgroundjob/joblist.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/lib/backgroundjob/joblist.php b/tests/lib/backgroundjob/joblist.php
index 13bee12479e..d5136676a47 100644
--- a/tests/lib/backgroundjob/joblist.php
+++ b/tests/lib/backgroundjob/joblist.php
@@ -202,4 +202,30 @@ class JobList extends \Test\TestCase {
$this->instance->remove($job);
}
+
+ public function testGetNextNonExisting() {
+ $job = new TestJob();
+ $this->instance->add($job, 1);
+ $this->instance->add('\OC\Non\Existing\Class');
+ $this->instance->add($job, 2);
+
+ $jobs = $this->instance->getAll();
+
+ $savedJob1 = $jobs[count($jobs) - 2];
+ $savedJob2 = $jobs[count($jobs) - 1];
+
+ $this->config->expects($this->any())
+ ->method('getAppValue')
+ ->with('backgroundjob', 'lastjob', 0)
+ ->will($this->returnValue($savedJob1->getId()));
+
+ $this->instance->getNext();
+
+ $nextJob = $this->instance->getNext();
+
+ $this->assertEquals($savedJob2, $nextJob);
+
+ $this->instance->remove($job, 1);
+ $this->instance->remove($job, 2);
+ }
}