Add intl email test.

This commit is contained in:
euromark 2014-09-16 10:14:00 +02:00
parent d34ff71e50
commit 4d1a65ede2
2 changed files with 4 additions and 1 deletions

View file

@ -597,7 +597,8 @@ class CakeEmail {
protected function _validateEmail($email) { protected function _validateEmail($email) {
if ($this->_emailPattern === null && filter_var($email, FILTER_VALIDATE_EMAIL)) { if ($this->_emailPattern === null && filter_var($email, FILTER_VALIDATE_EMAIL)) {
return; return;
} elseif (preg_match($this->_emailPattern, $email)) { }
if (preg_match($this->_emailPattern, $email)) {
return; return;
} }
throw new SocketException(__d('cake_dev', 'Invalid email: "%s"', $email)); throw new SocketException(__d('cake_dev', 'Invalid email: "%s"', $email));

View file

@ -267,6 +267,7 @@ class CakeEmailTest extends CakeTestCase {
$this->CakeEmail->addTo('jrbasso@cakephp.org'); $this->CakeEmail->addTo('jrbasso@cakephp.org');
$this->CakeEmail->addTo('mark_story@cakephp.org', 'Mark Story'); $this->CakeEmail->addTo('mark_story@cakephp.org', 'Mark Story');
$this->CakeEmail->addTo('foobar@ætdcadsl.dk');
$result = $this->CakeEmail->addTo(array('phpnut@cakephp.org' => 'PhpNut', 'jose_zap@cakephp.org')); $result = $this->CakeEmail->addTo(array('phpnut@cakephp.org' => 'PhpNut', 'jose_zap@cakephp.org'));
$expected = array( $expected = array(
'root@localhost' => 'root', 'root@localhost' => 'root',
@ -276,6 +277,7 @@ class CakeEmailTest extends CakeTestCase {
'root@cakephp.org' => 'root@cakephp.org', 'root@cakephp.org' => 'root@cakephp.org',
'jrbasso@cakephp.org' => 'jrbasso@cakephp.org', 'jrbasso@cakephp.org' => 'jrbasso@cakephp.org',
'mark_story@cakephp.org' => 'Mark Story', 'mark_story@cakephp.org' => 'Mark Story',
'foobar@ætdcadsl.dk' => 'foobar@ætdcadsl.dk',
'phpnut@cakephp.org' => 'PhpNut', 'phpnut@cakephp.org' => 'PhpNut',
'jose_zap@cakephp.org' => 'jose_zap@cakephp.org' 'jose_zap@cakephp.org' => 'jose_zap@cakephp.org'
); );