public function it_removes_subscription_when_max_cycles_hits_zero(RecurringSubscriptionInterface $subscription, SubscriptionEvent $event, ObjectManager $manager)
 {
     $subscription->getMaxCycles()->willReturn(0);
     $subscription->setMaxCycles(0)->shouldBeCalled();
     $event->getSubscription()->willReturn($subscription);
     $manager->remove($subscription)->shouldBeCalled();
     $this->onSuccess($event);
 }
 public function it_should_schedule_properly(SchedulableInterface $schedulable, RecurringSubscriptionInterface $recurring)
 {
     $interval = new \DateInterval('P3D');
     $recurring->getInterval()->willReturn($interval);
     $date = new \DateTime('+3 days');
     $schedulable->setScheduledDate($date)->shouldBeCalled();
     $this->schedule($schedulable, $recurring);
 }
 /**
  * {@inheritdoc}
  */
 public function schedule(SchedulableInterface $scheduleSubject, RecurringSubscriptionInterface $recurring)
 {
     $now = new \DateTime();
     $scheduleSubject->setScheduledDate($now->add($recurring->getInterval()));
 }