/** * Run repair step. * Must throw exception on error. * * @throws \Exception in case of failure */ public function run() { $oldJobs = $this->oldJobs(); foreach ($oldJobs as $job) { if ($this->jobList->has($job['class'], $job['arguments'])) { $this->jobList->remove($job['class'], $job['arguments']); } } }
public function testRun() { $this->assertTrue($this->jobList->has('OC\\Cache\\FileGlobalGC', null), 'Asserting that the job OC\\Cache\\FileGlobalGC exists before repairing'); $this->assertTrue($this->jobList->has('OC_Cache_FileGlobalGC', null), 'Asserting that the job OC_Cache_FileGlobalGC exists before repairing'); $repair = new \OC\Repair\DropOldJobs($this->jobList); $repair->run(); $this->assertFalse($this->jobList->has('OC\\Cache\\FileGlobalGC', null), 'Asserting that the job OC\\Cache\\FileGlobalGC does not exist after repairing'); $this->assertFalse($this->jobList->has('OC_Cache_FileGlobalGC', null), 'Asserting that the job OC_Cache_FileGlobalGC does not exist after repairing'); }
public function testRun() { $this->assertTrue($this->jobList->has('OC\\Cache\\FileGlobalGC', null), 'Asserting that the job OC\\Cache\\FileGlobalGC exists before repairing'); $this->assertTrue($this->jobList->has('OC_Cache_FileGlobalGC', null), 'Asserting that the job OC_Cache_FileGlobalGC exists before repairing'); /** @var IOutput | \PHPUnit_Framework_MockObject_MockObject $outputMock */ $outputMock = $this->getMockBuilder('\\OCP\\Migration\\IOutput')->disableOriginalConstructor()->getMock(); $repair = new \OC\Repair\DropOldJobs($this->jobList); $repair->run($outputMock); $this->assertFalse($this->jobList->has('OC\\Cache\\FileGlobalGC', null), 'Asserting that the job OC\\Cache\\FileGlobalGC does not exist after repairing'); $this->assertFalse($this->jobList->has('OC_Cache_FileGlobalGC', null), 'Asserting that the job OC_Cache_FileGlobalGC does not exist after repairing'); }