noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 06/07: Test for changes


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 06/07: Test for changes
Date: Sat, 27 Aug 2022 08:03:46 -0400 (EDT)

sparkyx pushed a commit to branch master
in repository noalyss.

commit e79a5e6b4d6a42cff374f4f8c860727bc777e614
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Fri Aug 26 17:09:18 2022 +0200

    Test for changes
---
 unit-test/dossier25.sql.gz                         | Bin 391680 -> 392940 bytes
 unit-test/include/class/acc_ledgerTest.php         |   2 +-
 ...rchase.Test.php => acc_ledger_purchaseTest.php} |   2 +-
 unit-test/include/lib/ac_commonTest.php            |  48 +++++++++++++++++++++
 4 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/unit-test/dossier25.sql.gz b/unit-test/dossier25.sql.gz
index 6699da9df..57a842401 100644
Binary files a/unit-test/dossier25.sql.gz and b/unit-test/dossier25.sql.gz 
differ
diff --git a/unit-test/include/class/acc_ledgerTest.php 
b/unit-test/include/class/acc_ledgerTest.php
index c97286ca0..8a5a953a1 100644
--- a/unit-test/include/class/acc_ledgerTest.php
+++ b/unit-test/include/class/acc_ledgerTest.php
@@ -822,7 +822,7 @@ class Acc_LedgerTest extends TestCase
         \Noalyss\Facility::save_file(__DIR__."/file", 
"acc_ledger-input_new.html", $result);
         $size=filesize(__DIR__."/file/acc_ledger-input_new.html");
                 
-        $this->assertEquals(16348,$size," output input_new is not what it is 
expected");
+        $this->assertEquals(15969,$size," output input_new is not what it is 
expected");
     }
 
     /**
diff --git a/unit-test/include/class/acc_ledger_purchase.Test.php 
b/unit-test/include/class/acc_ledger_purchaseTest.php
similarity index 99%
rename from unit-test/include/class/acc_ledger_purchase.Test.php
rename to unit-test/include/class/acc_ledger_purchaseTest.php
index c7492d10f..9f17ab819 100644
--- a/unit-test/include/class/acc_ledger_purchase.Test.php
+++ b/unit-test/include/class/acc_ledger_purchaseTest.php
@@ -332,7 +332,7 @@ class Acc_Ledger_PurchaseTest extends TestCase
                 '<OPTION VALUE="3" SELECTED>Achat',
                 $res);
         $this->assertStringContainsString('<INPUT TYPE="hidden" id="jrn_type" 
NAME="jrn_type" VALUE="ACH"',$res);
-        $this->assertStringContainsString('<td class="num">  <span id="tvac" 
>0.0</span> </td>',$res);
+        $this->assertStringContainsString('<span id="tvac" >0.0</span> 
</td>',$res);
         
     }
 
diff --git a/unit-test/include/lib/ac_commonTest.php 
b/unit-test/include/lib/ac_commonTest.php
index 2a2da0a0e..e86faa254 100644
--- a/unit-test/include/lib/ac_commonTest.php
+++ b/unit-test/include/lib/ac_commonTest.php
@@ -254,4 +254,52 @@ class Ac_CommonTest extends TestCase
                 
         }
     }
+
+    /**
+     * @covers h
+     * @return void
+     */
+    function testh()
+    {
+        $this->assertEquals("",h(null));
+        $this->assertEquals("",h(""));
+        $this->assertEquals("&lt;&amp;",h("<&"));
+        $this->assertEquals(0,h("0"));
+    }
+    function dataFormat_Date()
+    {
+        return array(
+                ["01.05.2000","DD.MM.YYYY","DD.MM.YY",'01.05.00'],
+                ["01.05.2000","DD.MM.YYYY","DD-MM-YY",'01-05-00'],
+                ["01.05.2000","DD.MM.YYYY","YYYYMMDD",'20000501'],
+                ["01.05.2000","DD.MM.YYYY","YYYY/MM/DD",'2000/05/01'],
+                ["2000-05-07","YYYY-MM-DD","DD.MM.YY",'07.05.00'],
+                ["","DD.MM.YYYY","DD.MM.YY",""],
+                ["1/1/1","DD.MM.YYYY","DD.MM.YY","1/1/1"],
+        );
+    }
+    /**
+     * @param $p_date
+     * @param $p_from
+     * @param $p_to
+     * @param $p_result
+     * @return void
+     * @throws Exception
+     * @dataProvider dataFormat_date
+     */
+    function testFormatDate($p_date,$p_from,$p_to,$p_result)
+    {
+        $this->assertEquals($p_result,format_date($p_date,$p_from,$p_to));
+    }
+    function testGenerate_Random_String()
+    {
+        $this->assertEquals(8,strlen(generate_random_string(8)));
+        $this->assertEquals(12,strlen(generate_random_string(12)));
+        $this->assertEquals(16,strlen(generate_random_string(16)));
+    }
+    function testDatabase_Escape_String()
+    {
+        
$this->assertEquals("l''éléphant",Database::escape_string("l'éléphant"));
+        
$this->assertEquals("l\''éléphant",Database::escape_string("l\'éléphant"));
+    }
 }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]