Ejemplo n.º 1
0
 public function testExecute()
 {
     $beforeExecute = new \DateTime();
     $jobInstance = new JobInstance('test_connector', JobInstance::TYPE_IMPORT, 'test_job_instance');
     $jobExecution = new JobExecution($jobInstance);
     $this->assertNull($jobExecution->getStartTime());
     $this->assertNull($jobExecution->getEndTIme());
     $this->assertEquals(BatchStatus::STARTING, $jobExecution->getStatus()->getValue(), 'Batch status starting');
     $this->job->setJobRepository($this->jobRepository);
     $this->job->execute($jobExecution);
     $this->assertGreaterThanOrEqual($beforeExecute, $jobExecution->getStartTime(), 'Start time after test beginning');
     $this->assertGreaterThanOrEqual($beforeExecute, $jobExecution->getEndTime(), 'End time after test beginning');
     $this->assertGreaterThanOrEqual($jobExecution->getEndTime(), $jobExecution->getStartTime(), 'End time after start time');
     // No step executed, must be not completed
     $this->assertEquals(BatchStatus::STARTED, $jobExecution->getStatus()->getValue(), 'Batch status started');
 }