summaryrefslogtreecommitdiffstats
path: root/tests/lib/backgroundjob
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2013-04-20 23:51:58 +0200
committerRobin Appelman <icewind@owncloud.com>2013-04-20 23:51:58 +0200
commit3aecfda0c052c1b7f7a4e3459f339a27298e32a7 (patch)
treee1bdfbeb194e666604530dd020ef391fea896bd9 /tests/lib/backgroundjob
parent7948341a86fb08d236bb53f8aece809ae10ba5f2 (diff)
downloadnextcloud-server-3aecfda0c052c1b7f7a4e3459f339a27298e32a7.tar.gz
nextcloud-server-3aecfda0c052c1b7f7a4e3459f339a27298e32a7.zip
Adjust backgroundjob test cases
Diffstat (limited to 'tests/lib/backgroundjob')
-rw-r--r--tests/lib/backgroundjob/dummyjoblist.php12
-rw-r--r--tests/lib/backgroundjob/queuedjob.php6
-rw-r--r--tests/lib/backgroundjob/timedjob.php2
3 files changed, 12 insertions, 8 deletions
diff --git a/tests/lib/backgroundjob/dummyjoblist.php b/tests/lib/backgroundjob/dummyjoblist.php
index c4ccfc22c9e..833607c15c2 100644
--- a/tests/lib/backgroundjob/dummyjoblist.php
+++ b/tests/lib/backgroundjob/dummyjoblist.php
@@ -26,17 +26,20 @@ class DummyJobList extends \OC\BackgroundJob\JobList {
/**
* @param \OC\BackgroundJob\Job|string $job
+ * @param mixed $argument
*/
- public function add($job) {
- if (!$this->has($job)) {
+ public function add($job, $argument = null) {
+ $job->setArgument($argument);
+ if (!$this->has($job, null)) {
$this->jobs[] = $job;
}
}
/**
* @param \OC\BackgroundJob\Job|string $job
+ * @param mixed $argument
*/
- public function remove($job) {
+ public function remove($job, $argument = null) {
$index = array_search($job, $this->jobs);
if ($index !== false) {
unset($this->jobs[$index]);
@@ -47,9 +50,10 @@ class DummyJobList extends \OC\BackgroundJob\JobList {
* check if a job is in the list
*
* @param $job
+ * @param mixed $argument
* @return bool
*/
- public function has($job) {
+ public function has($job, $argument) {
return array_search($job, $this->jobs) !== false;
}
diff --git a/tests/lib/backgroundjob/queuedjob.php b/tests/lib/backgroundjob/queuedjob.php
index 62d631a3ef0..1d373473cd7 100644
--- a/tests/lib/backgroundjob/queuedjob.php
+++ b/tests/lib/backgroundjob/queuedjob.php
@@ -9,7 +9,7 @@
namespace Test\BackgroundJob;
class TestQueuedJob extends \OC\BackgroundJob\QueuedJob {
- public function run() {
+ public function run($argument) {
throw new JobRun(); //throw an exception so we can detect if this function is called
}
}
@@ -32,11 +32,11 @@ class QueuedJob extends \PHPUnit_Framework_TestCase {
public function testJobShouldBeRemoved() {
try {
- $this->assertTrue($this->jobList->has($this->job));
+ $this->assertTrue($this->jobList->has($this->job, null));
$this->job->execute($this->jobList);
$this->fail("job should have been run");
} catch (JobRun $e) {
- $this->assertFalse($this->jobList->has($this->job));
+ $this->assertFalse($this->jobList->has($this->job, null));
}
}
}
diff --git a/tests/lib/backgroundjob/timedjob.php b/tests/lib/backgroundjob/timedjob.php
index 4147b82cbbe..0af933afef8 100644
--- a/tests/lib/backgroundjob/timedjob.php
+++ b/tests/lib/backgroundjob/timedjob.php
@@ -13,7 +13,7 @@ class TestTimedJob extends \OC\BackgroundJob\TimedJob {
$this->setInterval(10);
}
- public function run() {
+ public function run($argument) {
throw new JobRun(); //throw an exception so we can detect if this function is called
}
}