summaryrefslogtreecommitdiff
path: root/modules/gallery/tests/SafeString_Test.php
diff options
context:
space:
mode:
authorAndy Staudacher <andy.st@gmail.com>2009-08-30 15:21:02 -0700
committerAndy Staudacher <andy.st@gmail.com>2009-08-30 15:21:02 -0700
commitbeb711d6a0fedac0d4ca3b9bae162a6ce9d6cdeb (patch)
treebfb916d5c36c686b4ebcdab8e8c820b7f5302ace /modules/gallery/tests/SafeString_Test.php
parentb5813f92c7a73e11d47d1943c217fdf6b7e41de9 (diff)
Rename clean_js to js_string and have it return a complete JS string (with delimiters) instead of just the string contents.
Benefits: Using json_encode(), which is very robust. And as a user, it's clearer how to use this API compared to what it was before.
Diffstat (limited to 'modules/gallery/tests/SafeString_Test.php')
-rw-r--r--modules/gallery/tests/SafeString_Test.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/gallery/tests/SafeString_Test.php b/modules/gallery/tests/SafeString_Test.php
index 0fc7f6f3..ede55240 100644
--- a/modules/gallery/tests/SafeString_Test.php
+++ b/modules/gallery/tests/SafeString_Test.php
@@ -49,7 +49,7 @@ class SafeString_Test extends Unit_Test_Case {
public function for_js_test() {
$safe_string = new SafeString('"<em>Foo</em>\'s bar"');
$js_string = $safe_string->for_js();
- $this->assert_equal('\\"<em>Foo<\\/em>\\\'s bar\\"',
+ $this->assert_equal('"\\"<em>Foo<\\/em>\'s bar\\""',
$js_string);
}
@@ -96,21 +96,21 @@ class SafeString_Test extends Unit_Test_Case {
public function of_fluid_api_test() {
$escaped_string = SafeString::of("Foo's bar")->for_js();
- $this->assert_equal("Foo\\'s bar", $escaped_string);
+ $this->assert_equal('"Foo\'s bar"', $escaped_string);
}
public function safestring_of_safestring_preserves_safe_status_test() {
$safe_string = SafeString::of_safe_html("hello's <p>world</p>");
$safe_string_2 = new SafeString($safe_string);
$this->assert_equal("hello's <p>world</p>", $safe_string_2);
- $this->assert_equal("hello\\'s <p>world<\\/p>", $safe_string_2->for_js());
+ $this->assert_equal('"hello\'s <p>world<\\/p>"', $safe_string_2->for_js());
}
public function safestring_of_safestring_preserves_html_safe_status_test() {
$safe_string = SafeString::of_safe_html("hello's <p>world</p>");
$safe_string_2 = new SafeString($safe_string);
$this->assert_equal("hello's <p>world</p>", $safe_string_2);
- $this->assert_equal("hello\\'s <p>world<\\/p>", $safe_string_2->for_js());
+ $this->assert_equal('"hello\'s <p>world<\\/p>"', $safe_string_2->for_js());
}
public function safestring_of_safestring_safe_status_override_test() {