From bd0551b22076b82a6d49e9f7a2b2e0c90a1b2326 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak <alec@alec.pl> Date: Fri, 05 Feb 2016 07:25:27 -0500 Subject: [PATCH] Secure also downloads of addressbook exports, managesieve script exports and Enigma keys exports --- tests/Framework/Charset.php | 33 ++++++++++++++++++++++++++++++++- 1 files changed, 32 insertions(+), 1 deletions(-) diff --git a/tests/Framework/Charset.php b/tests/Framework/Charset.php index 1fd1654..752ddf4 100644 --- a/tests/Framework/Charset.php +++ b/tests/Framework/Charset.php @@ -4,6 +4,8 @@ * Test class to test rcube_charset class * * @package Tests + * @group iconv + * @group mbstring */ class Framework_Charset extends PHPUnit_Framework_TestCase { @@ -15,7 +17,8 @@ { return array( array('', ''), - array("\xC1", ''), + array("\xC1", ""), + array("Οὐχὶ ταὐτὰ παρίσταταί μοι γιγνώσκειν", "Οὐχὶ ταὐτὰ παρίσταταί μοι γιγνώσκειν"), ); } @@ -25,6 +28,16 @@ function test_clean($input, $output) { $this->assertEquals($output, rcube_charset::clean($input)); + } + + /** + * Just check for faulty byte-sequence, regardless of the actual cleaning results + */ + function test_clean_2() + { + $bogus = "сим\xD0вол"; + $this->assertRegExp('/\xD0\xD0/', $bogus); + $this->assertNotRegExp('/\xD0\xD0/', rcube_charset::clean($bogus)); } /** @@ -159,4 +172,22 @@ $this->assertEquals($output, rcube_charset::detect($input, $fallback)); } + /** + * Data for test_detect() + */ + function data_detect_with_lang() + { + return array( + array('��ܦW��,�D�n', 'zh_TW', 'BIG-5'), + ); + } + + /** + * @dataProvider data_detect_with_lang + */ + function test_detect_with_lang($input, $lang, $output) + { + $this->assertEquals($output, rcube_charset::detect($input, $output, $lang)); + } + } -- Gitblit v1.9.1