public function testTakeRetryPolicyFromRetriableInstance()
 {
     $workable = new WorkableThatUsesRetryStatistics();
     $job = Job::around($workable, $this->repository);
     $job->execute($this->getMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface'));
     $this->assertTrue($job->done(), "Job requiring retry statistics was not executed correctly: " . var_export($job->export(), true));
 }
 public function testTakeRetryPolicyFromRetriableInstance()
 {
     $retryPolicy = $this->getMock('Recruiter\\RetryPolicy\\BaseRetryPolicy');
     $retryPolicy->expects($this->once())->method('schedule');
     $workable = new WorkableThatIsAlsoRetriable($retryPolicy);
     $job = Job::around($workable, $this->repository);
     $job->execute($this->eventDispatcher);
 }
 public function testTakeRetryPolicyFromRetriableInstance()
 {
     $listener = $this->getMock('StdClass', ['onEvent']);
     $listener->expects($this->exactly(3))->method('onEvent')->withConsecutive([$this->equalTo('job.started'), $this->anything()], [$this->equalTo('job.ended'), $this->anything()], [$this->equalTo('job.failure.last'), $this->anything()]);
     $workable = new WorkableThatIsAlsoAnEventListener($listener);
     $job = Job::around($workable, $this->repository);
     $job->execute($this->dispatcher);
 }
Ejemplo n.º 4
0
 public function jobOf(Workable $workable)
 {
     return new JobToSchedule(Job::around($workable, $this->jobs));
 }
Ejemplo n.º 5
0
 private function aJob()
 {
     $workable = $this->getMockBuilder('Recruiter\\Workable')->getMock();
     return Job::around($workable, $this->repository)->scheduleAt(T\now()->before(T\seconds(5)));
 }