From 1467fa38070caf608fc0efd44a3a5b7bfa49f812 Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 13 Nov 2009 12:41:11 +0000 Subject: more test cases related to #1364. git-svn-id: http://code.elgg.org/elgg/trunk@3677 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/tests/services/api.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'engine/tests/services') diff --git a/engine/tests/services/api.php b/engine/tests/services/api.php index 57aaa08d5..2acda5823 100644 --- a/engine/tests/services/api.php +++ b/engine/tests/services/api.php @@ -236,6 +236,24 @@ class ElggCoreServicesApiTest extends ElggCoreUnitTest { $s = serialise_parameters('test', $parameters); $this->assertIdentical($s, ",'test\'ing'"); + // test string with \ in it + $this->registerFunction(false, false, array('param1' => array('type' => 'string'))); + $parameters = array('param1' => 'test\ing'); + $s = serialise_parameters('test', $parameters); + $this->assertIdentical($s, ",'test\\ing'"); + + // test string with \' in it + $this->registerFunction(false, false, array('param1' => array('type' => 'string'))); + $parameters = array('param1' => "test\'ing"); + $s = serialise_parameters('test', $parameters); + $this->assertIdentical($s, ",'test\\\\'ing'"); // test\\'ing + + // test string reported by twall in #1364 + $this->registerFunction(false, false, array('param1' => array('type' => 'string'))); + $parameters = array('param1' => '{"html":"
Blah Blah
"}'); + $s = serialise_parameters('test', $parameters); + $this->assertIdentical($s, ",'{\"html\":\"
Blah Blah
\"}'"); + // float $this->registerFunction(false, false, array('param1' => array('type' => 'float'))); $parameters = array('param1' => 2.5); -- cgit v1.2.3