noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 05/09: PHPUNIT : adapt test


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 05/09: PHPUNIT : adapt test
Date: Mon, 17 Jan 2022 14:58:29 -0500 (EST)

sparkyx pushed a commit to branch devel
in repository noalyss.

commit c9e120b8f9bb1f8ec3663c29c6840b0562c74951
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Wed Jan 5 15:26:56 2022 +0100

    PHPUNIT : adapt test
---
 unit-test/README                                    |   7 +++++++
 unit-test/dossier25.sql.gz                          | Bin 0 -> 391680 bytes
 unit-test/include/class/acc_account_ledger.Test.php |   6 +++---
 .../{acc_ledger.Test.php => acc_ledgerTest.php}     |   8 ++++----
 unit-test/include/class/acc_ledger_historyTest.php  |   4 ++--
 unit-test/include/class/pdf_anc_acc_list.Test.php   |   2 +-
 .../include/class/print_operation_currencyTest.php  |  20 ++++++++++----------
 7 files changed, 27 insertions(+), 20 deletions(-)

diff --git a/unit-test/README b/unit-test/README
index 221b5441..7128a5a5 100644
--- a/unit-test/README
+++ b/unit-test/README
@@ -4,6 +4,13 @@ Il faut configurer pour pouvoir l'utiliser :
 2 . dans GLOBAL PATH (propriété du projet) ajouter le fichier phpunit.phar
 3. Donner unit-test comme répertoire de test
 
+Base de données 
+===============
+Une base de données (dossier25.sql.gz) est donnée pour fonctionner avec les 
tests. Il faut la restaurer vide 
+puis exécuter le script avec psql 
+
+voir 
https://wiki.noalyss.eu/doku.php?id=tutoriaux:restaurer_un_dossier_manuellement
+
 Paramètrage
 ===========
 
diff --git a/unit-test/dossier25.sql.gz b/unit-test/dossier25.sql.gz
new file mode 100644
index 00000000..6699da9d
Binary files /dev/null and b/unit-test/dossier25.sql.gz differ
diff --git a/unit-test/include/class/acc_account_ledger.Test.php 
b/unit-test/include/class/acc_account_ledger.Test.php
index 9fb45eb3..cc9b7811 100644
--- a/unit-test/include/class/acc_account_ledger.Test.php
+++ b/unit-test/include/class/acc_account_ledger.Test.php
@@ -313,7 +313,7 @@ class Acc_Account_LedgerTest extends TestCase
     {
        global $g_connection;
        $accounting=new Acc_Account_Ledger($g_connection, '4511');
-       $this->assertEquals(319.05,$accounting->get_solde(),"get_solde");
+       $this->assertEquals(356.85,$accounting->get_solde(),"get_solde");
     }
 
     /**
@@ -325,8 +325,8 @@ class Acc_Account_LedgerTest extends TestCase
         $accounting=new Acc_Account_Ledger($g_connection, '4511');
         $expected=array (
                         'debit' => '0',
-                        'credit' => '319.0500',
-                        'solde' => 319.05,
+                        'credit' => '356.8500',
+                        'solde' => 356.85,
                       );
         $this->assertEquals($accounting->get_solde_detail(),$expected);
     }
diff --git a/unit-test/include/class/acc_ledger.Test.php 
b/unit-test/include/class/acc_ledgerTest.php
similarity index 99%
rename from unit-test/include/class/acc_ledger.Test.php
rename to unit-test/include/class/acc_ledgerTest.php
index 214b52dd..c97286ca 100644
--- a/unit-test/include/class/acc_ledger.Test.php
+++ b/unit-test/include/class/acc_ledgerTest.php
@@ -85,7 +85,7 @@ class Acc_LedgerTest extends TestCase
  
         $this->object->id=2;
         $sPj=$this->object->get_last_pj(2);
-        $this->assertEquals(39,$sPj);
+        $this->assertEquals(42,$sPj);
         $this->object->id=0;
         
         try {
@@ -233,7 +233,7 @@ class Acc_LedgerTest extends TestCase
     {
         $this->object->id=2;
         $r=$this->object->guess_pj();
-        $this->assertEquals("VEN40",$r);
+        $this->assertEquals("VEN43",$r);
     }
 
     /**
@@ -293,8 +293,8 @@ class Acc_LedgerTest extends TestCase
         $max=$g_connection->get_value("select max(p_id) from parm_periode");
         $min=$g_connection->get_value("select min(p_id) from parm_periode");
         $solde=$ledger->get_solde($min,$max);
-        $this->assertEquals($solde[1],4938.64);
-        $this->assertEquals($solde[0],4938.6400);
+        $this->assertEquals($solde[1],5156.4400);
+        $this->assertEquals($solde[0],5156.4400);
         
     }
 
diff --git a/unit-test/include/class/acc_ledger_historyTest.php 
b/unit-test/include/class/acc_ledger_historyTest.php
index 3c9a8991..c8cf33ba 100644
--- a/unit-test/include/class/acc_ledger_historyTest.php
+++ b/unit-test/include/class/acc_ledger_historyTest.php
@@ -118,7 +118,7 @@ class Acc_Ledger_HistoryTest extends TestCase
         $object=Acc_Ledger_History::factory($g_connection, [2],$p_min_id 
,$p_max_id , "D", 'all');
         $object->get_row();
         $a_row=$object->get_data();
-        $this->assertEquals(13,count($a_row));
+        $this->assertEquals(16,count($a_row));
         
         $object->set_filter_operation("paid");
         $object->get_row();
@@ -128,7 +128,7 @@ class Acc_Ledger_HistoryTest extends TestCase
         $object->set_filter_operation("unpaid");
         $object->get_row();
         $a_row=$object->get_data();
-        $this->assertEquals(7,count($a_row));
+        $this->assertEquals(10,count($a_row));
 
         
         }
diff --git a/unit-test/include/class/pdf_anc_acc_list.Test.php 
b/unit-test/include/class/pdf_anc_acc_list.Test.php
index f043f8a7..f73f17b8 100644
--- a/unit-test/include/class/pdf_anc_acc_list.Test.php
+++ b/unit-test/include/class/pdf_anc_acc_list.Test.php
@@ -134,7 +134,7 @@ EOF;
         $anc_acc_list->card_poste=2;
         $pdf_anc_acc=new PDF_Anc_Acc_List($anc_acc_list);
         
$pdf_anc_acc->export_pdf()->Output(__DIR__."/file/pdf_anc_acc_list-account-activity.pdf","F");
-        
$this->assertEquals(77152,filesize(__DIR__."/file/pdf_anc_acc_list-account-activity.pdf"),
+        
$this->assertEquals(77151,filesize(__DIR__."/file/pdf_anc_acc_list-account-activity.pdf"),
                __DIR__."/file/pdf_anc_acc_list-account-activity.pdf incorrect 
");
         
         // By Activity / Card
diff --git a/unit-test/include/class/print_operation_currencyTest.php 
b/unit-test/include/class/print_operation_currencyTest.php
index 7c54bebd..bf5fbdc1 100644
--- a/unit-test/include/class/print_operation_currencyTest.php
+++ b/unit-test/include/class/print_operation_currencyTest.php
@@ -54,7 +54,7 @@ class Print_Operation_CurrencyTest extends TestCase
        
         $this->assertStringContainsString(" and jrnx.f_id in ( select f_id 
from fiche where fd_id=$4)",$sql);
         $array=$object->get_data();
-        $this->assertEquals(count($array),0,"operation in EURO");
+        $this->assertEquals(count($array),5,"operation in EURO");
         
         
         $object->setCurrency_id(1);
@@ -82,12 +82,12 @@ class Print_Operation_CurrencyTest extends TestCase
        
         $this->assertStringContainsString("where jrn.currency_id = $1 
and",$sql);
         $array=$object->get_data();
-        $this->assertEquals(0,count($array),"operation in EURO");
+        $this->assertEquals(18,count($array),"operation in EURO");
         
         
         $object->setCurrency_id(1);
         $array=$object->get_data();
-        $this->assertEquals(18,count($array),"operations in Dollars");
+        $this->assertEquals(20,count($array),"operations in Dollars");
     }
     /**
      * @brief test Filter_Data_Currency_Card
@@ -109,13 +109,13 @@ class Print_Operation_CurrencyTest extends TestCase
        
         $this->assertStringContainsString("and f_id=$4",$sql);
         $array=$object->get_data();
-        $this->assertEquals(0,count($array),"operation in EURO");
+        $this->assertEquals(4,count($array),"operation in EURO");
         
         
         $object->setCurrency_id(1);
         $object->setCard("FOURNI1");
         $array=$object->get_data();
-        $this->assertEquals(2,count($array),"operations in Dollars");
+        $this->assertEquals(3,count($array),"operations in Dollars");
       }
       /**
        * @brief test Filter_Data_Currency_Card_Accounting
@@ -139,13 +139,13 @@ class Print_Operation_CurrencyTest extends TestCase
         $sql=$object->SQL_Condition();
         $this->assertStringContainsString("and j_poste >= $4 and j_poste <= 
$5",$sql);
         $array=$object->get_data();
-        $this->assertEquals(0,count($array),"operation in EURO");
+        $this->assertEquals(9,count($array),"operation in EURO");
         
         
         $object->setCurrency_id(1);
        
         $array=$object->get_data();
-        $this->assertEquals(7,count($array),"operations in Dollars");
+        $this->assertEquals(8,count($array),"operations in Dollars");
       }
       function testPrint_operation_currency()
       {
@@ -170,7 +170,7 @@ class Print_Operation_CurrencyTest extends TestCase
         Noalyss\Facility::save_file(__DIR__."/file", 
"print_operation_currency_by_accounting.csv",
                 $csv);
         
-        $this->assertEquals(0,count($array),"by_accounting operation in 
EURO"); 
+        $this->assertEquals(9,count($array),"by_accounting operation in 
EURO"); 
         
         $_REQUEST['p_currency_code']=1;
         $print_operation=Print_Operation_Currency::build("by_card");
@@ -188,11 +188,11 @@ class Print_Operation_CurrencyTest extends TestCase
 
           
         
-        $this->assertEquals(2,count($array),"by_card operation in USD"); 
+        $this->assertEquals(3,count($array),"by_card operation in USD"); 
         
         $print_operation=Print_Operation_Currency::build("all");
         $array=$print_operation->getData_operation()->get_data();
-        $this->assertEquals(20,count($array),"all operations in Dollars");
+        $this->assertEquals(22,count($array),"all operations in Dollars");
         ob_start();
         $print_operation->export_csv($export);
         $csv=ob_get_contents();



reply via email to

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