From 5f8097b9eba09302be561d67ce035275494043e3 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Mon, 27 Aug 2012 12:55:58 +0200 Subject: Added tests for specialchars quoting --- tests/Framework/Utils.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'tests/Framework/Utils.php') diff --git a/tests/Framework/Utils.php b/tests/Framework/Utils.php index 503b69a4a..e58835956 100644 --- a/tests/Framework/Utils.php +++ b/tests/Framework/Utils.php @@ -129,6 +129,36 @@ class Framework_Utils extends PHPUnit_Framework_TestCase $this->assertFalse(rcube_utils::check_ip($ip)); } + /** + * Data for test_rep_specialchars_output() + */ + function data_rep_specialchars_output() + { + return array( + array('', '', 'abc', 'abc'), + array('', '', '?', '?'), + array('', '', '"', '"'), + array('', '', '<', '<'), + array('', '', '>', '>'), + array('', '', '&', '&'), + array('', '', '&', '&amp;'), + array('', '', '', '<a>'), + array('', 'remove', '', ''), + ); + } + + /** + * Test for rep_specialchars_output + * @dataProvider data_rep_specialchars_output + */ + function test_rep_specialchars_output($type, $mode, $str, $res) + { + $result = rcube_utils::rep_specialchars_output( + $str, $type ? $type : 'html', $mode ? $mode : 'strict'); + + $this->assertEquals($result, $res); + } + /** * rcube_utils::mod_css_styles() */ -- cgit v1.2.3