From 5c264788422b7c29dd1bc05210ea4292ae0400dc Mon Sep 17 00:00:00 2001 From: David Flatz Date: Fri, 29 Jul 2022 14:44:35 +0200 Subject: rename _escape functions to _encode --- test/it_mail.t | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'test') diff --git a/test/it_mail.t b/test/it_mail.t index 6aefd84..41a92b1 100755 --- a/test/it_mail.t +++ b/test/it_mail.t @@ -7,19 +7,19 @@ $mail = new it_mail(); # header_escape tests # is( - $mail->addrlist_escape('éxample@example.com', true), + $mail->addrlist_encode('éxample@example.com', true), 'éxample@example.com', "Don't escape plain email addresses in email headers" ); is( - $mail->header_escape('éxample@example.com'), + $mail->header_encode('éxample@example.com'), '=?utf-8?Q?=C3=A9xample@example.com?=', "Escape plain email in non-email headers" ); is( - $mail->header_escape('search.ch e-mail code d\'accès'), + $mail->header_encode('search.ch e-mail code d\'accès'), version_compare(PHP_VERSION, '7.2.11') < 0 ? '=?utf-8?B?c2VhcmNoLmNoIGUtbWFpbCBjb2RlIGQnYWNjw6hz?=' : '=?utf-8?Q?search.ch=20e-mail=20code=20d\'acc=C3=A8s?=', @@ -27,37 +27,37 @@ is( ); is( - $mail->addrlist_escape('Èxample User <èxample@example.com>', true), + $mail->addrlist_encode('Èxample User <èxample@example.com>', true), '=?utf-8?Q?=C3=88xample=20User?= <èxample@example.com>', "Escape name but not email in email headers" ); is( - $mail->addrlist_escape('Example User ', true), + $mail->addrlist_encode('Example User ', true), 'Example User ', "Don't escape characters that don't need escaping" ); is( - $mail->addrlist_escape('example@example.com, éxample@example.com, Sömeone Ëlse ', true), + $mail->addrlist_encode('example@example.com, éxample@example.com, Sömeone Ëlse ', true), 'example@example.com, éxample@example.com, =?utf-8?Q?S=C3=B6meone=20=C3=8Blse?= ', "Don't escape email addresses but escape realnames" ); is( - $mail->addrlist_escape('"Alfred E. Neuman" ', true), + $mail->addrlist_encode('"Alfred E. Neuman" ', true), '"Alfred E. Neuman" ', "Don't remove quoting characters from realname" ); is( - $mail->addrlist_escape('"Schmitt, Sören" ', true), + $mail->addrlist_encode('"Schmitt, Sören" ', true), '=?utf-8?Q?"Schmitt,=20S=C3=B6ren"?= ', "Don't remove quoting characters from realname when it contains a quotable character" ); is( - $mail->addrlist_escape('"Alfred E. Neuman" ', true), + $mail->addrlist_encode('"Alfred E. Neuman" ', true), '"Alfred E. Neuman" ', "Convert domain in email to idn version" ); @@ -119,5 +119,5 @@ is(it_mail::email_split('test@sör.ch'), ['test', 'sör.ch'], 'email_split test@ is(it_mail::email_split('"test@local.ch".foo.bar@search.ch'), ['"test@local.ch".foo.bar', 'search.ch'], 'email_split "test@local.ch".foo.bar@search.ch'); is(it_mail::email_split('aneuman'), ['aneuman', ''], 'email_split aneuman'); -is(it_mail::email_escape('test@sör.ch'), 'test@xn--sr-fka.ch', 'idn encode domain sör.ch'); -is(it_mail::email_escape('أحمد@مثال.آزمایشی'), 'أحمد@xn--mgbh0fb.xn--hgbk6aj7f53bba', 'idn encode domain ﻢﺛﺎﻟ.ﺁﺰﻣﺎﯿﺸﯾ'); +is(it_mail::email_encode('test@sör.ch'), 'test@xn--sr-fka.ch', 'idn encode domain sör.ch'); +is(it_mail::email_encode('أحمد@مثال.آزمایشی'), 'أحمد@xn--mgbh0fb.xn--hgbk6aj7f53bba', 'idn encode domain ﻢﺛﺎﻟ.ﺁﺰﻣﺎﯿﺸﯾ'); -- cgit v1.2.3