/**
  * Test doStuffOnPrePersist
  */
 public function testDoStuffOnPrePersist()
 {
     $emailSendReceive = new EmailSendReceive();
     $dateTime = new DateTime();
     $emailSendReceive->setReceivedAt($dateTime);
     $this->assertEquals($dateTime, $emailSendReceive->getReceivedAt());
     $this->assertEquals(EmailSendReceive::STATUS_CREATED, $emailSendReceive->getStatus());
 }
 /**
  * @param EmailSendReceive $emailSendCheckI
  *
  * @throws EmailReceiveCheckException
  */
 protected function timeReceiveCheck(EmailSendReceive $emailSendCheckI)
 {
     $timeLeft = time() - $emailSendCheckI->getSentAt()->getTimestamp();
     if ($timeLeft > $this->getReceiveMaxTime()) {
         $emailSendCheckI->setStatus(EmailSendReceive::STATUS_EXPIRED);
         $emailSendCheckI->setReceivedAt(new DateTime());
         throw EmailReceiveCheckException::receivingMaxTimeExpire($emailSendCheckI->getSubject(), $timeLeft, $this->getReceiveMaxTime());
     }
 }