/** * @dataProvider getNonTerminatedStatus */ public function testUpdateJobWithNonTerminatedStatusValues($status) { $schedule = new Schedule(); $schedule->setIsActive(true); $job = new Job(); $job->addSchedule($schedule); $this->subject->updateJob($job, $status); $this->assertEquals($status, $job->getStatus()); $this->assertNull($job->getTerminatedAt()); $this->assertTrue($schedule->getIsActive()); }
public function testOnSchedule() { $job = new Job(); $job->setType('type'); $job->setTicket('ticket'); $schedule = new Schedule(); $schedule->setJob($job); $event = new SchedulerEvent($schedule); $self = $this; $this->producer->expects($this->once())->method('produce')->willReturnCallback(function (Message $message) use($self) { $this->assertEquals('ticket', $message->getTicket()); $this->assertEquals('type', $message->getType()); }); $this->subject->onSchedule($event); }
/** * Override clone in order to avoid duplicating entries in Doctrine */ public function __clone() { parent::__clone(); $this->id = null; }