示例#1
0
文件: Email.php 项目: gudwin/extasy
 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);
 }
示例#2
0
 public function testValid()
 {
     $validator = new Email('*****@*****.**');
     $this->assertTrue($validator->isValid());
 }