/** * Tests that it is possible to set email regex configuration to a CakeEmail object * * @return void */ public function testConfigEmailPattern() { $regex = '/.+@.+\\..+/i'; $email = new Email(array('emailPattern' => $regex)); $this->assertSame($regex, $email->emailPattern()); }
/** * Tests that it is possible to unset the email pattern and make use of filter_var() instead. * * @return void * * @expectedException \InvalidArgumentException * @expectedExceptionMessage Invalid email: "*****@*****.**" */ public function testUnsetEmailPattern() { $email = new Email(); $this->assertSame(Email::EMAIL_PATTERN, $email->emailPattern()); $email->emailPattern(null); $this->assertNull($email->emailPattern()); $email->to('*****@*****.**'); $email->to('*****@*****.**'); }