From fcef56fd6f930254c039b89cb7410a993857f12c Mon Sep 17 00:00:00 2001 From: Erik Amaru Ortiz Date: Thu, 17 May 2012 17:31:48 -0400 Subject: [PATCH] Update G Unit Test & Fix on G::emailAddress() function - imcomplete comment exist on G Test file - reoving a G::pr on G::emailAddress() function --- gulliver/system/class.g.php | 9 +++++++-- tests/unit/gulliver/system/GTest.php | 5 ++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/gulliver/system/class.g.php b/gulliver/system/class.g.php index 646ec2139..65ae79626 100755 --- a/gulliver/system/class.g.php +++ b/gulliver/system/class.g.php @@ -3275,22 +3275,27 @@ $output = $outputHeader.$output; */ function emailAddress($sEmail){ $o = new stdClass(); + if( strpos($sEmail, '<') !== false ) { preg_match('/([\"\w@\.-_\s]*\s*)?(<(\w+[\.-]?\w+]*@\w+([\.-]?\w+)*\.\w{2,3})+>)/', $sEmail, $matches); - g::pr($matches); + if( isset($matches[1]) && $matches[3]){ $o->email = $matches[3]; $o->name = $matches[1]; + return $o; } + return false; - } else { + } + else { preg_match('/\w+[\.-]?\w+]*@\w+([\.-]?\w+)*\.\w{2,3}+/', $sEmail, $matches); if( isset($matches[0]) ){ $o->email = $matches[0]; $o->name = ''; return $o; } + return false; } } diff --git a/tests/unit/gulliver/system/GTest.php b/tests/unit/gulliver/system/GTest.php index 515f14053..c6cc9ea1b 100644 --- a/tests/unit/gulliver/system/GTest.php +++ b/tests/unit/gulliver/system/GTest.php @@ -1406,7 +1406,10 @@ class GTest extends PHPUnit_Framework_TestCase */ public function testSendMail() { - need email + // Remove the following lines when you implement this test. + $this->markTestIncomplete( + 'This test has not been implemented yet.' + ); } /**