public function testIncrementSentCount() { $notification = new Notification(); $this->assertEquals(0, $notification->getSentCount()); $notification->incrementSentCount(); $this->assertEquals(1, $notification->getSentCount()); }
private function scheduleNotification(Notification $notification) { $notification->incrementSentCount(); $seconds = $this->scheduler->getDiffInSeconds($notification->getSentCount()); $notification->setSentAt(new \DateTime())->setScheduledAt((new \DateTime())->modify("+{$seconds} seconds")); $this->storage->persist($notification); }
/** * @param string $id * @param string $data * @return Notification */ private function createNotification($id, $data) { $notification = new Notification(); $notification->setId($id)->setData($data)->setSentAt(new \DateTime())->setSentCount(0); return $notification; }