diff options
author | Aleksander Machniak <alec@alec.pl> | 2012-08-29 08:23:26 +0200 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2012-08-29 08:23:26 +0200 |
commit | 528113069db7734cc6a85557291cc9f3c8d8bb91 (patch) | |
tree | 815578437b83907d6d9265bce30f5f155c14de0f /tests/Framework | |
parent | c59a822a65bac2aa53eb41978b1ac2d5192710e6 (diff) |
More tests
Diffstat (limited to 'tests/Framework')
-rw-r--r-- | tests/Framework/Shared.php | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/Framework/Shared.php b/tests/Framework/Shared.php index d38fb03a3..99ef829da 100644 --- a/tests/Framework/Shared.php +++ b/tests/Framework/Shared.php @@ -158,4 +158,47 @@ class Framework_Shared extends PHPUnit_Framework_TestCase $this->assertEquals($input_str, $result_str, "Invalid array_keys_recursive() result"); } + + /** + * rcube_shared.inc: format_email() + */ + function test_format_email() + { + $data = array( + '' => '', + 'test' => 'test', + 'test@test.tld' => 'test@test.tld', + 'test@[127.0.0.1]' => 'test@[127.0.0.1]', + 'TEST@TEST.TLD' => 'TEST@test.tld', + ); + + foreach ($data as $value => $expected) { + $result = format_email($value); + $this->assertEquals($expected, $result, "Invalid format_email() result for $value"); + } + + } + + /** + * rcube_shared.inc: format_email_recipient() + */ + function test_format_email_recipient() + { + $data = array( + '' => array(''), + 'test' => array('test'), + 'test@test.tld' => array('test@test.tld'), + 'test@[127.0.0.1]' => array('test@[127.0.0.1]'), + 'TEST@TEST.TLD' => array('TEST@TEST.TLD'), + 'TEST <test@test.tld>' => array('test@test.tld', 'TEST'), + '"TEST\"" <test@test.tld>' => array('test@test.tld', 'TEST"'), + ); + + foreach ($data as $expected => $value) { + $result = format_email_recipient($value[0], $value[1]); + $this->assertEquals($expected, $result, "Invalid format_email_recipient()"); + } + + } + } |