diff --git a/tests/json/sanitizer_test.php b/tests/json/sanitizer_test.php new file mode 100644 index 0000000000..7082d88590 --- /dev/null +++ b/tests/json/sanitizer_test.php @@ -0,0 +1,35 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +use phpbb\json\sanitizer; + +class phpbb_json_sanitizer_test extends phpbb_test_case +{ + public function data_decode() + { + return [ + [false, []], + ['', []], + ['{ "name": "phpbb/phpbb-style-prosilver"}', ['name' => 'phpbb/phpbb-style-prosilver']], + ['{ "name":[[ "phpbb/phpbb-style-prosilver"}', []], + ]; + } + + /** + * @dataProvider data_decode + */ + public function test_decode_data($input, $output) + { + $this->assertEquals($output, sanitizer::decode($input)); + } +}