示例#1
0
 public function setup()
 {
     $this->jobList = new DummyJobList();
     $this->job = new TestTimedJob($this);
     $this->jobList->add($this->job);
     $this->jobRun = false;
 }
示例#2
0
文件: timedjob.php 项目: evanjt/core
 protected function setup()
 {
     parent::setUp();
     $this->jobList = new DummyJobList();
     $this->job = new TestTimedJob($this);
     $this->jobList->add($this->job);
     $this->jobRun = false;
 }
示例#3
0
文件: job.php 项目: evanjt/core
 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());
 }
示例#4
0
 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());
 }
示例#5
0
 public function testJobShouldBeRemoved()
 {
     $this->assertTrue($this->jobList->has($this->job, null));
     $this->job->execute($this->jobList);
     $this->assertTrue($this->jobRun);
 }