Translated using Weblate.
[phpmyadmin.git] / test / libraries / js_escape_test.php
blob0bc904b5194d2a90e708af71e68950ae9a936227
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * tests for JS variable formatting
6 * @package PhpMyAdmin-test
7 */
9 /*
10 * Include to test.
12 require_once 'libraries/js_escape.lib.php';
14 class PMA_JS_Escape_test extends PHPUnit_Framework_TestCase
16 /**
17 * @dataProvider variables
19 public function testFormat($key, $value, $expected)
21 $this->assertEquals($expected, PMA_getJsValue($key, $value));
24 public function variables() {
25 return array(
26 array('foo', true, "foo = true;\n"),
27 array('foo', false, "foo = false;\n"),
28 array('foo', 100, "foo = 100;\n"),
29 array('foo', 0, "foo = 0;\n"),
30 array('foo', 'text', "foo = \"text\";\n"),
31 array('foo', 'quote"', "foo = \"quote\\\"\";\n"),
32 array('foo', 'apostroph\'', "foo = \"apostroph\\'\";\n"),