public function testSentAtGetterAndSetter() { $entity = new Email(); $date = new \DateTime('now', new \DateTimeZone('UTC')); $entity->setSentAt($date); $this->assertEquals($date, $entity->getSentAt()); }
public function testGetDate() { $email = new Email(); $date = new \DateTime('now', new \DateTimeZone('UTC')); $email->setSentAt($date); $this->assertSame($date, $this->provider->getDate($email)); }
public function inapplicableEmailsProvider() { $date = new \DateTime('now', new \DateTimeZone('UTC')); $oldEmailDate = new \DateTime('now', new \DateTimeZone('UTC')); $oldEmailDate->sub(\DateInterval::createFromDateString('2 day')); $applicableSubjectsAndBodies = [['not empty subject', 'This is email body with offer, sale and won words.', $date], [null, 'This email has nothing.', $date], [null, 'This is email body with sale and won words.', $oldEmailDate]]; $data = array_map(function ($subjectAndBody) { list($subject, $bodyContent, $sentAt) = $subjectAndBody; $body = new EmailBody(); $body->setBodyContent($bodyContent); $email = new Email(); $email->setSubject($subject); $email->setEmailBody($body); $email->setSentAt($sentAt); return [$email]; }, $applicableSubjectsAndBodies); return $data; }