/** * @covers drieschel\batches\Batch::run */ public function testRunWithExecutionDateReached() { $halfHourAgo = new \DateTime('@' . (time() - 1800)); $oneHourAgo = new \DateTime('@' . (time() - 3600)); touch($this->runFile, $oneHourAgo->getTimestamp()); $jobMock = $this->getMockBuilder('\\drieschel\\batches\\Job')->getMock(); $batch = new Batch('test', $this->runFilesDir); $batch->executionPlan('*', '*', '*', $halfHourAgo->format('m'), '0'); $batch->addJob($jobMock); $now = new \DateTime(); $batch->run(); clearstatcache(); $lastRunTime = filemtime($this->runFile); $this->assertTrue($lastRunTime >= $now->getTimestamp()); }