summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/appframework/http/JSONResponseTest.php26
1 files changed, 20 insertions, 6 deletions
diff --git a/tests/lib/appframework/http/JSONResponseTest.php b/tests/lib/appframework/http/JSONResponseTest.php
index 692237f57b2..253c523934b 100644
--- a/tests/lib/appframework/http/JSONResponseTest.php
+++ b/tests/lib/appframework/http/JSONResponseTest.php
@@ -66,13 +66,27 @@ class JSONResponseTest extends \Test\TestCase {
$this->assertEquals($expected, $this->json->render());
}
+ /**
+ * @return array
+ */
+ public function testRenderProvider() {
+ return [
+ [
+ ['test' => 'hi'], '{"test":"hi"}',
+ ],
+ [
+ ['<h1>test' => '<h1>hi'], '{"\u003Ch1\u003Etest":"\u003Ch1\u003Ehi"}',
+ ],
+ ];
+ }
- public function testRender() {
- $params = array('test' => 'hi');
- $this->json->setData($params);
-
- $expected = '{"test":"hi"}';
-
+ /**
+ * @dataProvider testRenderProvider
+ * @param array $input
+ * @param string $expected
+ */
+ public function testRender(array $input, $expected) {
+ $this->json->setData($input);
$this->assertEquals($expected, $this->json->render());
}