From 2507722a4cff7207d961557b0bd8322e7e62d7d8 Mon Sep 17 00:00:00 2001 From: jcm Date: Mon, 13 Jun 2022 17:26:05 +0200 Subject: [PATCH 1/6] Add test for iconv_mime_encode() for preference input-charset --- ext/iconv/tests/iconv_mime_encode_001.phpt | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 ext/iconv/tests/iconv_mime_encode_001.phpt diff --git a/ext/iconv/tests/iconv_mime_encode_001.phpt b/ext/iconv/tests/iconv_mime_encode_001.phpt new file mode 100644 index 0000000000000..8c0f5f68741fd --- /dev/null +++ b/ext/iconv/tests/iconv_mime_encode_001.phpt @@ -0,0 +1,26 @@ +--TEST-- +iconv_mime_encode(): Encoding parameter exceeds the maximum allowed for preference "input-charset" +--CREDITS-- +Juan Carlos Morales (jcmargentina@gmail.com) +--EXTENSIONS-- +iconv +--INI-- +iconv.internal_charset=iso-8859-1 +--FILE-- + "ISO-8859-1".$extra, + "output-charset" => "UTF-8", + "line-length" => 76, + "line-break-chars" => "\n" +); +$preferences["scheme"] = "B"; + +$result = iconv_mime_encode("Subject", "Prüfung", $preferences); +var_dump($result); +?> +--EXPECTF-- +%s Encoding parameter exceeds the maximum allowed length of %s +bool(false) \ No newline at end of file From 9e9655bfc7ee141a105ec71267bbcccb05520743 Mon Sep 17 00:00:00 2001 From: jcm Date: Mon, 13 Jun 2022 19:27:45 +0200 Subject: [PATCH 2/6] Enhancing test code and changing error message expectations for test on iconv_mime_encode() function --- ext/iconv/tests/iconv_mime_encode_001.phpt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ext/iconv/tests/iconv_mime_encode_001.phpt b/ext/iconv/tests/iconv_mime_encode_001.phpt index 8c0f5f68741fd..76546970d3e5e 100644 --- a/ext/iconv/tests/iconv_mime_encode_001.phpt +++ b/ext/iconv/tests/iconv_mime_encode_001.phpt @@ -10,17 +10,17 @@ iconv.internal_charset=iso-8859-1 "ISO-8859-1".$extra, "output-charset" => "UTF-8", "line-length" => 76, - "line-break-chars" => "\n" -); -$preferences["scheme"] = "B"; + "line-break-chars" => "\n", + "scheme" => "B" +]; $result = iconv_mime_encode("Subject", "Prüfung", $preferences); var_dump($result); ?> --EXPECTF-- -%s Encoding parameter exceeds the maximum allowed length of %s +Warning: iconv_mime_encode(): Encoding parameter exceeds the maximum allowed length of %d characters in %s on line %d bool(false) \ No newline at end of file From e92637e51d9e4d3f89a6f9166e4d5f12aa63ef5b Mon Sep 17 00:00:00 2001 From: jcm Date: Mon, 13 Jun 2022 19:29:52 +0200 Subject: [PATCH 3/6] Deleting the CREDITS section from the test --- ext/iconv/tests/iconv_mime_encode_001.phpt | 2 -- 1 file changed, 2 deletions(-) diff --git a/ext/iconv/tests/iconv_mime_encode_001.phpt b/ext/iconv/tests/iconv_mime_encode_001.phpt index 76546970d3e5e..f0159b6d45d6e 100644 --- a/ext/iconv/tests/iconv_mime_encode_001.phpt +++ b/ext/iconv/tests/iconv_mime_encode_001.phpt @@ -1,7 +1,5 @@ --TEST-- iconv_mime_encode(): Encoding parameter exceeds the maximum allowed for preference "input-charset" ---CREDITS-- -Juan Carlos Morales (jcmargentina@gmail.com) --EXTENSIONS-- iconv --INI-- From f45b4907c718ad795b8ca893015687079914be18 Mon Sep 17 00:00:00 2001 From: jcm Date: Mon, 13 Jun 2022 19:31:04 +0200 Subject: [PATCH 4/6] Adding new line at the end of the test --- ext/iconv/tests/iconv_mime_encode_001.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/iconv/tests/iconv_mime_encode_001.phpt b/ext/iconv/tests/iconv_mime_encode_001.phpt index f0159b6d45d6e..ee6c20c34acad 100644 --- a/ext/iconv/tests/iconv_mime_encode_001.phpt +++ b/ext/iconv/tests/iconv_mime_encode_001.phpt @@ -21,4 +21,4 @@ var_dump($result); ?> --EXPECTF-- Warning: iconv_mime_encode(): Encoding parameter exceeds the maximum allowed length of %d characters in %s on line %d -bool(false) \ No newline at end of file +bool(false) From 35bf6c3b1371d74d851ed5221d5390b784f7dad4 Mon Sep 17 00:00:00 2001 From: jcm Date: Mon, 13 Jun 2022 19:50:58 +0200 Subject: [PATCH 5/6] Added more coverage to same test as scope belongs to this test subject --- ext/iconv/tests/iconv_mime_encode_001.phpt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ext/iconv/tests/iconv_mime_encode_001.phpt b/ext/iconv/tests/iconv_mime_encode_001.phpt index ee6c20c34acad..d5a0183a7dcbb 100644 --- a/ext/iconv/tests/iconv_mime_encode_001.phpt +++ b/ext/iconv/tests/iconv_mime_encode_001.phpt @@ -16,9 +16,18 @@ $preferences = [ "scheme" => "B" ]; +$result = iconv_mime_encode("Subject", "Prüfung", $preferences); +var_dump($result); + +$preferences["input-charset"] = "ISO-8859-1"; +$preferences["output-charset"] = "UTF-8".$extra; + $result = iconv_mime_encode("Subject", "Prüfung", $preferences); var_dump($result); ?> --EXPECTF-- Warning: iconv_mime_encode(): Encoding parameter exceeds the maximum allowed length of %d characters in %s on line %d bool(false) + +Warning: iconv_mime_encode(): Encoding parameter exceeds the maximum allowed length of %d characters in %s on line %d +bool(false) From 39b77fce02062d73280025a5584f4bf98bd3baff Mon Sep 17 00:00:00 2001 From: jcm Date: Mon, 13 Jun 2022 19:55:28 +0200 Subject: [PATCH 6/6] Updated test title to mention output-charset preference. --- ext/iconv/tests/iconv_mime_encode_001.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/iconv/tests/iconv_mime_encode_001.phpt b/ext/iconv/tests/iconv_mime_encode_001.phpt index d5a0183a7dcbb..f4d9469eeaaae 100644 --- a/ext/iconv/tests/iconv_mime_encode_001.phpt +++ b/ext/iconv/tests/iconv_mime_encode_001.phpt @@ -1,5 +1,5 @@ --TEST-- -iconv_mime_encode(): Encoding parameter exceeds the maximum allowed for preference "input-charset" +iconv_mime_encode(): Encoding parameter exceeds the maximum allowed for preference "input-charset" and "output-charset" --EXTENSIONS-- iconv --INI--