Changeset 399
- Timestamp:
- Jun 22, 2012 2:25:43 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Email.inc.php
r396 r399 90 90 // The regex used in validEmail(). Set here instead of in the default _params above so we can use the concatenation . dot. 91 91 // This matches a (valid) email address as complex as: 92 // "Jane & Bob Smith" <bob&smith's/dep=sales!@smith-wick.ca.us > (Sales department)92 // "Jane & Bob Smith" <bob&smith's/dep=sales!@smith-wick.ca.us > (Sales department) 93 93 // ...and something as simple as: 94 94 // x@x.com 95 $this->setParam(array('regex' => '/^(?:(?:"[^"]*?"\s*|[^,@]*)(< )|(?:"[^"]*?"|[^,@]*)\s+|)' // Display name95 $this->setParam(array('regex' => '/^(?:(?:"[^"]*?"\s*|[^,@]*)(<\s*)|(?:"[^"]*?"|[^,@]*)\s+|)' // Display name 96 96 . '((?:[^.<>\s@",\[\]]+[^<>\s@",\[\]])*[^.<>\s@",\[\]]+)' // Local-part 97 97 . '@' // @ … … 102 102 . '[.-]?(?:[A-Z0-9]+[-.])*(?:[A-Z0-9]+\.)+[A-Z]{2,6}))' // FALSE, matches domain name 103 103 . '(?(1)' // Comment conditional for if initial < exists 104 . '(?: >\s*|>\s+\([^,@]+\)\s*)' // TRUE, ensure ending >104 . '(?:\s*>\s*|>\s+\([^,@]+\)\s*)' // TRUE, ensure ending > 105 105 . '|' 106 106 . '(?:|\s*|\s+\([^,@]+\)\s*))$/i')); // FALSE ensure there is no ending > -
trunk/tests/EmailTest.php
r396 r399 113 113 } 114 114 } 115 $this->assertEquals(4 1, $gc, 'Unexpected good count.');116 $this->assertEquals(4 7, $bc, 'Unexpected bad count.');115 $this->assertEquals(45, $gc, 'Unexpected number of valid emails found.'); 116 $this->assertEquals(45, $bc, 'Unexpected number of invalid emails found.'); 117 117 // echo "Good addresses: $gc\n"; 118 118 // echo "Bad addresses: $bc\n"; 119 //echo join("\n", $bad);120 //echo "\n";119 // echo join("\n", $bad); 120 // echo "\n"; 121 121 } 122 122 -
trunk/tests/_email_test_addresses.txt
r42 r399 22 22 cthornhill_94%1@yahoo.com 23 23 "bob!#$%&'*+-/=?^_`.{|}~rice@domain.com", 24 m üllér@domain.com24 mÃŒllér@domain.com 25 25 sarah.adams.2008@femba.ucla.edu 26 26 dig@whap.heck.suddenly.willy.sam.digity.okay.com.org … … 48 48 < asdf@domain.com> 49 49 <asdf@domain.com > 50 Mr. Asdf < asdf@domain.com> 51 Mr. Asdf <asdf@domain.com > 50 52 asdf@domain.com> 51 53 <asdf@domain.com -
trunk/tests/run_tests.sh
r357 r399 3 3 # Be in the directory with all the tests. 4 4 cd `dirname $0`; 5 6 # Create database. 7 mysql -e 'CREATE DATABASE IF NOT EXISTS `test`'; 5 8 6 9 # Run tests sequentially.
Note: See TracChangeset
for help on using the changeset viewer.