diff options
author | uckelman <uckelman@nomic.net> | 2010-11-25 11:15:16 +0000 |
---|---|---|
committer | uckelman <uckelman@nomic.net> | 2010-11-25 11:15:16 +0000 |
commit | fb4c36d7cb6042fbec466f9bfb1cf3d0caeb6854 (patch) | |
tree | ed038ba4066f381541d5d39995962f37e192883f /test | |
parent | f74323a49897c9e646d586b68ec80cc0f3773d02 (diff) |
Added has_rfc822_specials and rfc822_quote for handling names in email addresses.
git-svn-id: https://vassalengine.svn.sourceforge.net/svnroot/vassalengine/site-src/trunk@7492 67b53d14-2c14-4ace-a08f-0dab2b34000c
Diffstat (limited to 'test')
-rw-r--r-- | test/UtilTest.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/UtilTest.php b/test/UtilTest.php index 7135b9f..1cf8eac 100644 --- a/test/UtilTest.php +++ b/test/UtilTest.php @@ -5,6 +5,33 @@ require_once('PHPUnit/Framework.php'); require_once(__DIR__ . '/../src/Util.php'); class UtilTest extends PHPUnit_Framework_TestCase { + + public function has_rfc822_specials_provider() { + return array( + array('Joel Uckelman', false), + array('L.Tankersley', true), + array('()<>@,;:\".[]', true) + ); + } + + /** @dataProvider has_rfc822_specials_provider */ + public function test_has_rfc822_specials($string, $expected) { + $this->assertEquals($expected, has_rfc_822_specials($string)); + } + + public function rfc822_quote_provider() { + return array( + array('Joel Uckelman', 'Joel Uckelman'), + array('L.Tankersley', '"L.Tankersley"'), + array('"\foo\"', '"\"\\foo\\\""') + ); + } + + /** @dataProvider rfc822_quote_provider */ + public function test_rfc822_quote($string, $expected) { + $this->assertEquals($expected, rfc_822_quote($string)); + } + public function is_ascii_provider() { return array( array('', true), |