Beispiel #1
0
 public function testHierarchyRun_2Parents()
 {
     $cmd1 = $this->schedule->getJob(1);
     $this->schedule->run($cmd1);
     $cmd2 = $this->schedule->getJob(2);
     $this->schedule->run($cmd2);
     $cmd3 = $this->schedule->getJob(3);
     $this->schedule->run($cmd3);
     $this->assertEquals(1, $cmd1->status_code);
     $this->assertEquals(0, $cmd1->exit_code);
     $this->assertEquals(4, $cmd2->status_code);
     $this->assertEquals(0, $cmd2->exit_code);
     $this->assertEquals(4, $cmd3->status_code);
     $this->assertEquals(0, $cmd3->exit_code);
     while ($this->schedule->isRunning($cmd1)) {
         $this->schedule->isRunning($cmd2);
         $this->schedule->isRunning($cmd3);
         sleep(1);
     }
     $this->assertEquals(0, $cmd1->status_code);
     $this->assertEquals(0, $cmd1->exit_code);
     $this->assertEquals(1, $cmd2->status_code);
     $this->assertEquals(0, $cmd2->exit_code);
     $this->assertEquals(4, $cmd3->status_code);
     $this->assertEquals(0, $cmd3->exit_code);
     while ($this->schedule->isRunning($cmd2)) {
         $this->schedule->isRunning($cmd3);
         sleep(1);
     }
     $this->assertEquals(0, $cmd1->status_code);
     $this->assertEquals(0, $cmd1->exit_code);
     $this->assertEquals(0, $cmd2->status_code);
     $this->assertEquals(0, $cmd2->exit_code);
     $this->assertEquals(1, $cmd3->status_code);
     $this->assertEquals(0, $cmd3->exit_code);
     while ($this->schedule->isRunning($cmd3)) {
         sleep(1);
     }
     $this->assertEquals(0, $cmd1->status_code);
     $this->assertEquals(0, $cmd1->exit_code);
     $this->assertEquals(0, $cmd2->status_code);
     $this->assertEquals(0, $cmd2->exit_code);
     $this->assertEquals(0, $cmd3->status_code);
     $this->assertEquals(0, $cmd3->exit_code);
 }
Beispiel #2
0
 private function refreshJobs()
 {
     foreach ($this->jobs as $job) {
         $this->schedule->isRunning($job);
     }
 }
Beispiel #3
0
 public function testStartDueJobs_3Jobs()
 {
     $this->daemon->startDueJobs(new DateTime('00:00:00'));
     $this->assertTrue($this->schedule->isRunning($this->schedule->getJob(1)));
     $this->assertFalse($this->schedule->isRunning($this->schedule->getJob(2)));
     $this->assertFalse($this->schedule->isRunning($this->schedule->getJob(3)));
     $this->assertTrue($this->schedule->isRunning($this->schedule->getJob(4)));
     while ($this->schedule->isRunning($this->schedule->getJob(1))) {
         sleep(1);
     }
     $this->assertFalse($this->schedule->isRunning($this->schedule->getJob(1)));
     $this->assertTrue($this->schedule->isRunning($this->schedule->getJob(2)));
     $this->assertFalse($this->schedule->isRunning($this->schedule->getJob(3)));
     while ($this->schedule->isRunning($this->schedule->getJob(4))) {
         sleep(1);
     }
     $this->assertFalse($this->schedule->isRunning($this->schedule->getJob(4)));
     while ($this->schedule->isRunning($this->schedule->getJob(2))) {
         sleep(1);
     }
     $this->assertFalse($this->schedule->isRunning($this->schedule->getJob(1)));
     $this->assertFalse($this->schedule->isRunning($this->schedule->getJob(2)));
     $this->assertFalse($this->schedule->isRunning($this->schedule->getJob(3)));
     $this->assertFalse($this->schedule->isRunning($this->schedule->getJob(4)));
 }