|
@@ 144-165 (lines=22) @@
|
| 141 |
|
$this->assertEquals(15, $this->instance->getLastJob()); |
| 142 |
|
} |
| 143 |
|
|
| 144 |
|
public function testGetNext() { |
| 145 |
|
$job = new TestJob(); |
| 146 |
|
$this->instance->add($job, 1); |
| 147 |
|
$this->instance->add($job, 2); |
| 148 |
|
|
| 149 |
|
$jobs = $this->getAllSorted(); |
| 150 |
|
|
| 151 |
|
$savedJob1 = $jobs[count($jobs) - 2]; |
| 152 |
|
$savedJob2 = $jobs[count($jobs) - 1]; |
| 153 |
|
|
| 154 |
|
$this->config->expects($this->once()) |
| 155 |
|
->method('getAppValue') |
| 156 |
|
->with('backgroundjob', 'lastjob', 0) |
| 157 |
|
->will($this->returnValue($savedJob2->getId())); |
| 158 |
|
|
| 159 |
|
$nextJob = $this->instance->getNext(); |
| 160 |
|
|
| 161 |
|
$this->assertEquals($savedJob1, $nextJob); |
| 162 |
|
|
| 163 |
|
$this->instance->remove($job, 1); |
| 164 |
|
$this->instance->remove($job, 2); |
| 165 |
|
} |
| 166 |
|
|
| 167 |
|
public function testGetNextWrapAround() { |
| 168 |
|
$job = new TestJob(); |
|
@@ 167-188 (lines=22) @@
|
| 164 |
|
$this->instance->remove($job, 2); |
| 165 |
|
} |
| 166 |
|
|
| 167 |
|
public function testGetNextWrapAround() { |
| 168 |
|
$job = new TestJob(); |
| 169 |
|
$this->instance->add($job, 1); |
| 170 |
|
$this->instance->add($job, 2); |
| 171 |
|
|
| 172 |
|
$jobs = $this->getAllSorted(); |
| 173 |
|
|
| 174 |
|
$savedJob1 = $jobs[count($jobs) - 2]; |
| 175 |
|
$savedJob2 = $jobs[count($jobs) - 1]; |
| 176 |
|
|
| 177 |
|
$this->config->expects($this->once()) |
| 178 |
|
->method('getAppValue') |
| 179 |
|
->with('backgroundjob', 'lastjob', 0) |
| 180 |
|
->will($this->returnValue($savedJob1->getId())); |
| 181 |
|
|
| 182 |
|
$nextJob = $this->instance->getNext(); |
| 183 |
|
|
| 184 |
|
$this->assertEquals($savedJob2, $nextJob); |
| 185 |
|
|
| 186 |
|
$this->instance->remove($job, 1); |
| 187 |
|
$this->instance->remove($job, 2); |
| 188 |
|
} |
| 189 |
|
|
| 190 |
|
/** |
| 191 |
|
* @dataProvider argumentProvider |