Adaptation PHPUNIT

This commit is contained in:
sparkyx 2024-01-13 17:12:20 +01:00
parent 590856dcf7
commit 5401578512
3 changed files with 20 additions and 34 deletions

View file

@ -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
*/

View file

@ -66,6 +66,7 @@ class Noalyss_Parameter_FolderTest extends TestCase
"MY_ALPHANUM,".
"MY_UPDLAB,".
"MY_ANC_FILTER,".
"MY_REPORT,".
"MY_STOCK");
}

View file

@ -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