예제 #1
0
 public function testGetNextSkipNonExisting()
 {
     $job = new TestJob();
     $this->createTempJob('\\OC\\Non\\Existing\\Class', 1, 0, 12345);
     $this->createTempJob(get_class($job), 2, 0, 12346);
     $this->timeFactory->expects($this->atLeastOnce())->method('getTime')->willReturn(123456789);
     $nextJob = $this->instance->getNext();
     $this->assertEquals(get_class($job), get_class($nextJob));
     $this->assertEquals(2, $nextJob->getArgument());
 }
예제 #2
0
 public function testGetNextWrapAround()
 {
     $job = new TestJob();
     $this->instance->add($job, 1);
     $this->instance->add($job, 2);
     $jobs = $this->instance->getAll();
     $savedJob2 = $jobs[count($jobs) - 1];
     $this->config->expects($this->once())->method('getAppValue')->with('backgroundjob', 'lastjob', 0)->will($this->returnValue($savedJob2->getId()));
     $nextJob = $this->instance->getNext();
     $this->assertEquals($jobs[0], $nextJob);
     $this->instance->remove($job, 1);
     $this->instance->remove($job, 2);
 }
예제 #3
0
파일: joblist.php 프로젝트: TechArea/core
 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->getAllSorted();
     $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);
 }