public function testBeforeSave() { $entity = new Email(); $entity->beforeSave(); $createdAt = new \DateTime('now', new \DateTimeZone('UTC')); $this->assertEquals(Email::NORMAL_IMPORTANCE, $entity->getImportance()); $this->assertGreaterThanOrEqual($createdAt, $entity->getCreated()); }
/** * @param Email $email * @param string $importance */ protected function processImportance(Email $email, $importance) { if ($email->getId()) { if ($email->getImportance() != $importance) { throw $this->createInvalidPropertyException('Importance', $this->emailImportanceTransformer->transform($email->getImportance()), $this->emailImportanceTransformer->transform($importance)); } } else { $email->setImportance($importance); } }