public function setup() { $this->jobList = new DummyJobList(); $this->job = new TestQueuedJob($this); $this->jobList->add($this->job); $this->jobRun = false; }
protected function setup() { parent::setUp(); $this->jobList = new DummyJobList(); $this->job = new TestQueuedJob($this); $this->jobList->add($this->job); $this->jobRun = false; }
public function testRemoveAfterException() { $jobList = new DummyJobList(); $job = new TestJob($this, function () { throw new \Exception(); }); $jobList->add($job); $this->assertCount(1, $jobList->getAll()); $job->execute($jobList); $this->assertTrue($this->run); $this->assertCount(0, $jobList->getAll()); }
public function testRemoveAfterException() { $jobList = new DummyJobList(); $job = new TestJob($this, function () { throw new \Exception(); }); $jobList->add($job); $logger = $this->getMockBuilder('OCP\\ILogger')->disableOriginalConstructor()->getMock(); $logger->expects($this->once())->method('error')->with('Error while running background job: '); $this->assertCount(1, $jobList->getAll()); $job->execute($jobList, $logger); $this->assertTrue($this->run); $this->assertCount(1, $jobList->getAll()); }