diff options
author | David Flatz | 2014-04-28 14:55:03 +0200 |
---|---|---|
committer | David Flatz | 2014-04-28 15:54:58 +0200 |
commit | db2d783be5c72d445f97aae5a0cb51fe2504b983 (patch) | |
tree | 3b16c42aae1bc92a5062eab0e1be9b5d9f3207e4 | |
parent | 251da6fbd82b9e289430b330d403a318586da416 (diff) | |
download | itools-db2d783be5c72d445f97aae5a0cb51fe2504b983.tar.gz itools-db2d783be5c72d445f97aae5a0cb51fe2504b983.tar.bz2 itools-db2d783be5c72d445f97aae5a0cb51fe2504b983.zip |
add tests for it_mail headers
-rwxr-xr-x | tests/it_mail.t | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/it_mail.t b/tests/it_mail.t new file mode 100755 index 0000000..181c3df --- /dev/null +++ b/tests/it_mail.t @@ -0,0 +1,43 @@ +#!/www/server/bin/php -qC +<?php + +$mail = new it_mail(); + +# +# header_escape tests +# +is( + $mail->header_escape('éxample@example.com', true), + 'éxample@example.com', + "Don't escape plain email addresses in email headers", +); + +is( + $mail->header_escape('éxample@example.com'), + '=?utf-8?Q?=C3=A9xample@example.com?=', + "Escape plain email in non-email headers", +); + +is( + $mail->header_escape('Èxample User <èxample@example.com>', true), + '=?utf-8?Q?=C3=88xample_User?= <èxample@example.com>', + "Escape name but not email in email headers", +); + +is( + $mail->header_escape('Example User <example@example.com>', true), + 'Example User <example@example.com>', + "Don't escape characters that don't need escaping" +); + +is( + $mail->header_escape('example@example.com, éxample@example.com, Sömeone Ëlse <sömeone@example.com>', true), + 'example@example.com, éxample@example.com,=?utf-8?Q?_S=C3=B6meone_=C3=8Blse?= <sömeone@example.com>', + "Don't escape email addresses but escape realnames", +); + +is( + $mail->header_escape('"Alfred E. Neuman" <neuman@example.com>', true), + '"Alfred E. Neuman" <neuman@example.com>', + "Don't remove quoting characters from realname", +); |