noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 29/34: Adaptation PHPUNIT


From: dwm
Subject: [Noalyss-commit] [noalyss] 29/34: Adaptation PHPUNIT
Date: Wed, 17 Jan 2024 12:54:08 -0500 (EST)

sparkyx pushed a commit to branch devel
in repository noalyss.

commit 1eb013a6ca84240c9fcab0cf421ea696a137acd0
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Sat Jan 13 17:12:20 2024 +0100

    Adaptation PHPUNIT
---
 unit-test/include/class/acc_ledgerTest.php         | 32 ----------------------
 .../include/class/noalyss_parameter_folderTest.php |  1 +
 .../{tax_summary.Test.php => tax_summaryTest.php}  | 21 ++++++++++++--
 3 files changed, 20 insertions(+), 34 deletions(-)

diff --git a/unit-test/include/class/acc_ledgerTest.php 
b/unit-test/include/class/acc_ledgerTest.php
index e73dae402..be2aa1ce6 100644
--- a/unit-test/include/class/acc_ledgerTest.php
+++ b/unit-test/include/class/acc_ledgerTest.php
@@ -702,38 +702,6 @@ class Acc_LedgerTest extends TestCase
         $this->assertEquals("3,2,4,5",$ledger->get_all_fiche_def());
     }
 
-    /**
-     * @covers Acc_Ledger::get_saldo_exercice
-     */
-    public function testGet_saldo_exercice()
-    {
-        $result=[
-            ["solde"=>  658.25 , "j_poste"=> "4400004", "j_qcode"=> "FOURNI"],
-            ["solde"=> 660.17 , "j_poste"=> "4000005", "j_qcode"=> "CLIENT1"],
-            ["solde"=>  87.8400, "j_poste"=> "4112", "j_qcode"=> ""],
-            ["solde"=>-114.57  , "j_poste"=> "4511", "j_qcode"=> ""],
-            ["solde"=> -1496.3400 , "j_poste"=>"4400005", "j_qcode"=> 
"FOURNI1"]
-        ];
-        $get=$this->object->get_saldo_exercice("2018");
-        $nb_get=count($get);
-        $nb_result=count($result);
-        $ix=0;
-        for ($i=0;$i<$nb_get;$i++)
-        {
-            for ($e=0;$e<$nb_result;$e++) {
-                if (
-                        $result[$e]["j_poste"] == $get[$i]["j_poste"] && 
-                        $result[$e]["j_qcode"] == $get[$i]["j_qcode"] 
-                        ) 
-                {
-                    
$this->assertEquals($result[$e]["solde"],$get[$i]["solde"]);
-                    $ix++;
-                }
-            }
-        }
-        $this->assertEquals(5,$ix);
-    }
-
     /**
      * @covers Acc_Ledger::get_last_date
      */
diff --git a/unit-test/include/class/noalyss_parameter_folderTest.php 
b/unit-test/include/class/noalyss_parameter_folderTest.php
index fae33f608..a98affd2b 100644
--- a/unit-test/include/class/noalyss_parameter_folderTest.php
+++ b/unit-test/include/class/noalyss_parameter_folderTest.php
@@ -66,6 +66,7 @@ class Noalyss_Parameter_FolderTest extends TestCase
                                     "MY_ALPHANUM,".                
                                     "MY_UPDLAB,".                  
                                     "MY_ANC_FILTER,".                  
+                                    "MY_REPORT,".
                                     "MY_STOCK");
                 
     }
diff --git a/unit-test/include/class/tax_summary.Test.php 
b/unit-test/include/class/tax_summaryTest.php
similarity index 94%
rename from unit-test/include/class/tax_summary.Test.php
rename to unit-test/include/class/tax_summaryTest.php
index 2e35860d4..7c45b4418 100644
--- a/unit-test/include/class/tax_summary.Test.php
+++ b/unit-test/include/class/tax_summaryTest.php
@@ -21,6 +21,8 @@ use PHPUnit\Framework\TestCase;
  */
 // Copyright (2002-2019) Author Dany De Bontridder <danydb@noalyss.eu>
 
+require_once DIRTEST."/global.php";
+
 /**
  * @file
  * @brief 
@@ -40,6 +42,7 @@ class Tax_SummaryTest extends TestCase
     protected function setUp():void
     {
         global $g_connection;
+        $g_connection=Dossier::connect();
         $this->object=new \Tax_Summary($g_connection, "01.01.2014", 
"31.12.2019");
     }
 
@@ -70,6 +73,8 @@ class Tax_SummaryTest extends TestCase
 
     function testDisplay()
     {
+        global $g_connection,$g_user;
+        $g_user=new Noalyss_user($g_connection);
         $this->expectOutputRegex("/.*0,00.*\<\/tr\>\<\/table\>\n/");
         $this->object->display();
     }
@@ -155,6 +160,9 @@ class Tax_SummaryTest extends TestCase
     }
     function testGet_row_purchase()
     {
+        global $g_connection,$g_user;
+        $g_user=new Noalyss_user($g_connection);
+
         // Operation date
         $this->object->set_tva_type("O");
         $array=$this->object->get_row_purchase();
@@ -185,7 +193,10 @@ class Tax_SummaryTest extends TestCase
 
     function testGet_row_sale()
     {
-         $this->object->set_tva_type("O");
+        global $g_connection,$g_user;
+        $g_user=new Noalyss_user($g_connection);
+
+        $this->object->set_tva_type("O");
         $array=$this->object->get_row_sale();
         //-- For creating the array
          Noalyss\Facility::save_file(__DIR__."/file", 
"tax_summary_getrow_sale_o.txt", var_export($array, TRUE));
@@ -212,7 +223,10 @@ class Tax_SummaryTest extends TestCase
 
     function testget_summary_purchase()
     {
-         $this->object->set_tva_type("T");
+        global $g_connection,$g_user;
+        $g_user=new Noalyss_user($g_connection);
+
+        $this->object->set_tva_type("T");
         $array=$this->object->get_summary_purchase();
         //-- For creating the array
         Noalyss\Facility::save_file(__DIR__."/file", 
"tax_summary_getsummary_purchase_t.txt", var_export($array, TRUE));
@@ -238,6 +252,9 @@ class Tax_SummaryTest extends TestCase
 
     function testget_summary_sale()
     {
+        global $g_connection,$g_user;
+        $g_user=new Noalyss_user($g_connection);
+
         $this->object->set_tva_type("O");
         $array=$this->object->get_summary_sale();
         //-- For creating the array



reply via email to

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