public function setValue($newValue) { if (!empty($newValue)) { $validator = new EmailValidator($newValue); if (!$validator->isValid()) { throw new \InvalidArgumentException(sprintf('Not an email: "%s"', $newValue)); } } return parent::setValue($newValue); }
public function testValid() { $validator = new Email('*****@*****.**'); $this->assertTrue($validator->isValid()); }