public function testValidateEmail() { $this->assertTrue(ae_Validate::emailSloppy('*****@*****.**')); $this->assertTrue(ae_Validate::emailSloppy('exämple_ß14@example.com')); $this->assertFalse(ae_Validate::emailSloppy('example.com')); $this->assertFalse(ae_Validate::emailSloppy("exa\tmp\nle.com")); $this->assertFalse(ae_Validate::emailSloppy('exämpleß.com')); $this->assertFalse(ae_Validate::emailSloppy('example@example@example.com')); $this->assertFalse(ae_Validate::emailSloppy(TRUE)); }
/** * Set the author email. * @param {string} $email The author email. Can either be empty or a valid email. * @throws {Exception} If neither empty nor valid. */ public function setAuthorEmail($email) { $email = trim($email); if ($email !== '' && !ae_Validate::emailSloppy($email)) { $msg = sprintf('[%s] Not a valid eMail: %s', get_class(), htmlspecialchars($email)); throw new Exception($msg); } $this->authorEmail = $email; }