From a0e0d17725fe3ad60aed5c906943e5169e67544d Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Mon, 17 Feb 2014 15:40:04 +0100
Subject: [PATCH] Qual: More PHP unit to test dol_escapejs function. Qual: More
 PHP unit to test FormAdmin class.

---
 test/phpunit/AllTests.php      | 6 ++++++
 test/phpunit/FunctionsTest.php | 8 +++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/test/phpunit/AllTests.php b/test/phpunit/AllTests.php
index 7958fd5fe38..ae4691ae694 100644
--- a/test/phpunit/AllTests.php
+++ b/test/phpunit/AllTests.php
@@ -171,6 +171,12 @@ class AllTests
         require_once dirname(__FILE__).'/ModulesTest.php';  // At end because it's the longer
         $suite->addTestSuite('ModulesTest');
 
+
+        // GUI
+        require_once dirname(__FILE__).'/FormAdminTest.php';
+		$suite->addTestSuite('FormAdminTest');
+
+
         return $suite;
     }
 }
diff --git a/test/phpunit/FunctionsTest.php b/test/phpunit/FunctionsTest.php
index c58da9efa38..caa798beb46 100755
--- a/test/phpunit/FunctionsTest.php
+++ b/test/phpunit/FunctionsTest.php
@@ -403,7 +403,13 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
     {
         $input="x&<b>#</b>,\"'";    // " will be converted into '
         $result=dol_escape_js($input);
-        $this->assertEquals("x&<b>#<\/b>,\'\'",$result);
+        $this->assertEquals("x&<b>#</b>,\'\'",$result,"Test mode=0");
+
+        $result=dol_escape_js($input,1);
+        $this->assertEquals("x&<b>#</b>,\"\'",$result,"Test mode=1");
+
+        $result=dol_escape_js($input,2);
+        $this->assertEquals("x&<b>#</b>,\\\"'",$result,"Test mode=2");
     }
 
 
-- 
GitLab