Permalink
Browse files

Adding additional tests for object() encoding.

  • Loading branch information...
1 parent 69de129 commit 4d4bc9040e470fef419fcfbf3b6c708ea7bccac3 @markstory markstory committed Jul 11, 2009
Showing with 9 additions and 1 deletion.
  1. +9 −1 cake/tests/cases/libs/view/helpers/js.test.php
View
10 cake/tests/cases/libs/view/helpers/js.test.php
@@ -413,9 +413,17 @@ function testObjectAgainstJsonEncode() {
$data['mystring'] = "a \"double-quoted\" string";
$this->assertEqual(json_encode($data), $this->JsEngine->object($data));
-
+
$data['mystring'] = 'a \\"double-quoted\\" string';
$this->assertEqual(json_encode($data), $this->JsEngine->object($data));
+
+ unset($data['mystring']);
+ $data[3] = array(1, 2, 3);
+ $this->assertEqual(json_encode($data), $this->JsEngine->object($data));
+
+ unset($data[3]);
+ $data = array('mystring' => null, 'bool' => false, 'array' => array(1, 44, 66));
+ $this->assertEqual(json_encode($data), $this->JsEngine->object($data));
}
/**
* test that JSON made with JsBaseEngineHelper::object() against json_decode()

0 comments on commit 4d4bc90

Please sign in to comment.