diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-11-13 12:41:11 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-11-13 12:41:11 +0000 |
commit | 1467fa38070caf608fc0efd44a3a5b7bfa49f812 (patch) | |
tree | 9ec29bbae253459a659053b14eaae38c5158e40f /engine | |
parent | b080fd96052b1f970495e34841b1b61de34e3f24 (diff) | |
download | elgg-1467fa38070caf608fc0efd44a3a5b7bfa49f812.tar.gz elgg-1467fa38070caf608fc0efd44a3a5b7bfa49f812.tar.bz2 |
more test cases related to #1364.
git-svn-id: http://code.elgg.org/elgg/trunk@3677 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r-- | engine/tests/services/api.php | 18 |
1 files changed, 18 insertions, 0 deletions
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":"<div><img src=\\"http://foo.com\\"/>Blah Blah</div>"}');
+ $s = serialise_parameters('test', $parameters);
+ $this->assertIdentical($s, ",'{\"html\":\"<div><img src=\\\"http://foo.com\\\"/>Blah Blah</div>\"}'");
+
// float
$this->registerFunction(false, false, array('param1' => array('type' => 'float')));
$parameters = array('param1' => 2.5);
|