|
|
@@ -39,6 +39,27 @@ class JobTest extends \Test\TestCase { |
|
|
|
$this->assertCount(1, $jobList->getAll()); |
|
|
|
} |
|
|
|
|
|
|
|
public function testRemoveAfterError() { |
|
|
|
$jobList = new DummyJobList(); |
|
|
|
$job = new TestJob($this, function () { |
|
|
|
$test = null; |
|
|
|
$test->someMethod(); |
|
|
|
}); |
|
|
|
$jobList->add($job); |
|
|
|
|
|
|
|
$logger = $this->getMockBuilder(ILogger::class) |
|
|
|
->disableOriginalConstructor() |
|
|
|
->getMock(); |
|
|
|
$logger->expects($this->once()) |
|
|
|
->method('logException') |
|
|
|
->with($this->isInstanceOf(\Throwable::class)); |
|
|
|
|
|
|
|
$this->assertCount(1, $jobList->getAll()); |
|
|
|
$job->execute($jobList, $logger); |
|
|
|
$this->assertTrue($this->run); |
|
|
|
$this->assertCount(1, $jobList->getAll()); |
|
|
|
} |
|
|
|
|
|
|
|
public function markRun() { |
|
|
|
$this->run = true; |
|
|
|
} |