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()); }