[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 09/27: Test : Acc_Ledger_FIN
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 09/27: Test : Acc_Ledger_FIN |
Date: |
Sat, 2 Nov 2019 18:12:14 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 0017b4db13d51f727cba88503af72c43545b1eee
Author: Dany De Bontridder <address@hidden>
Date: Sat Nov 2 13:35:15 2019 +0100
Test : Acc_Ledger_FIN
---
.../include/class/acc_ledger_finTest.class.php | 142 +++++++++++++++------
1 file changed, 104 insertions(+), 38 deletions(-)
diff --git a/unit-test/include/class/acc_ledger_finTest.class.php
b/unit-test/include/class/acc_ledger_finTest.class.php
index 1d6fe32..4e3d471 100644
--- a/unit-test/include/class/acc_ledger_finTest.class.php
+++ b/unit-test/include/class/acc_ledger_finTest.class.php
@@ -12,7 +12,10 @@ class Acc_Ledger_FinTest extends TestCase
* @var Acc_Ledger_Fin
*/
protected $object;
-
+ /**
+ * @var contains array for new record
+ */
+ private $array;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
@@ -21,6 +24,51 @@ class Acc_Ledger_FinTest extends TestCase
{
include 'global.php';
$this->object=new Acc_Ledger_Fin($g_connection, 1);
+ $this->array= array
+ (
+ "ledger_type" => "fin",
+ "ac" => "COMPTA/MENUFIN/FIN",
+ "gDossier" => DOSSIER,
+ "nb_item" => 5,
+ "chdate" => 1,
+ "e_date" => "24.02.2018",
+ "p_jrn" => 1,
+ "e_pj" => "FIN3",
+ "e_pj_suggest" => "FIN3",
+ "first_sold" => -658.25,
+ "last_sold" => "",
+ "dateop0" => "",
+ "e_other0" => "CLIENT1",
+ "e_other_name0" => "Client 2",
+ "e_other0_comment" => "",
+ "e_other0_amount" => 123.1,
+ "e_concerned0" => "",
+ "dateop1" => "",
+ "e_other1" => "FOURNI",
+ "e_other_name1" => "Fournisseur 1",
+ "e_other1_comment" => "",
+ "e_other1_amount" => -400.76,
+ "e_concerned1" => "",
+ "dateop2" => "",
+ "e_other2" => "",
+ "e_other_name2" => "",
+ "e_other2_comment" =>"" ,
+ "e_other2_amount" => 0,
+ "e_concerned2" => "",
+ "dateop3" => "",
+ "e_other3" => "",
+ "e_other_name3" => "",
+ "e_other3_comment" => "",
+ "e_other3_amount" => 0,
+ "e_concerned3" => "",
+ "dateop4" => "",
+ "e_other4" => "",
+ "e_other_name4" => "",
+ "e_other4_comment" => "",
+ "e_other4_amount" => 0,
+ "e_concerned4" => "",
+ "save" => "Sauve"
+ );
}
/**
@@ -36,81 +84,99 @@ class Acc_Ledger_FinTest extends TestCase
/**
* @covers Acc_Ledger_Fin::input
- * @todo Implement testInput().
*/
public function testInput()
{
- // we must compare the output to a file we save previously
-
+ $result=$this->object->input($this->array);
+ $this->assertContains("show_fin_chdate('chdate');",$result);
}
/**
* @covers Acc_Ledger_Fin::confirm
- * @todo Implement testConfirm().
*/
public function testConfirm()
{
- // we must compare the output to a file we save previously
+ $array=$this->array;
+ unset($array["save"]);
+ $array["confirm"]="confirm";
+ $array["pa_id"]=array(2);
+ $array["first_sold"]=-658.25;
+ $array["last_sold"]="";
+ $array["mt"]="1572695340.6768";
+ $result=$this->object->confirm($array);
+ $this->assertContains('<fieldset><legend>Banque, caisse </legend><div
id="jrn_name_div">',$result);
+ $this->assertContains('<INPUT TYPE="hidden" id="dateop1"
NAME="dateop1" VALUE="">',$result);
+ $this->assertContains('<INPUT TYPE="hidden" id="chdate" NAME="chdate"
VALUE="1">',$result);
+
+ }
+ private function clean_operation()
+ {
+ global $g_connection;
+ $g_connection->exec_sql("delete from quant_fin
+ where j_id in (select j_id from jrnx join jrn
+ on (j_grpt=jr_grpt_id)
+ where
+ jr_mt=$1)",
+ [ '1572695340.6768']
+ );
+ $g_connection->exec_sql("delete from jrn
+ where
+ jr_mt=$1",
+ [ '1572695340.6768']
+ );
+ $g_connection->exec_sql(' delete from jrnx where j_grpt not in (select
jr_grpt_id from jrn)');
+ $g_connection->commit();
}
-
/**
* @covers Acc_Ledger_Fin::insert
- * @todo Implement testInsert().
+ * @covers Acc_Ledger_Fin::insert_quant_fin
*/
public function testInsert()
{
+ $array=$this->array;
+ $array["pa_id"]=array(2);
+ $array["first_sold"]=-658.25;
+ $array["last_sold"]="";
+ $array["mt"]="1572695340.6768";
+ $_FILES=array
+ (
+ 'pj'=>array
+ (
+ "name"=>"",
+ "type"=>"",
+ "tmp_name"=>"",
+ "error"=>4,
+ "size"=>0
+ )
+ );
+ $this->clean_operation();
+ $ret=$this->object->insert($array);
+ $this->assertContains('<table class="result" ><tr ><th
>Date</th>',$ret);
+ $this->assertContains(' HREF="javascript:modifyOperation',$ret);
+ $this->assertContains('-935,91',$ret);
+ $this->clean_operation();
}
- /**
- * @covers Acc_Ledger_Fin::show_ledger
- * @todo Implement testShow_ledger().
- */
- public function testShow_ledger()
- {
- }
/**
* @covers Acc_Ledger_Fin::get_bank_name
- * @todo Implement testGet_bank_name().
*/
public function testGet_bank_name()
{
$name=$this->object->get_bank_name();
- var_export($name);
if (strpos($name, NOTFOUND)!=0) $this->assertTrue(FALSE);
$this->assertTrue(TRUE);
}
/**
* @covers Acc_Ledger_Fin::get_bank
- * @todo Implement testGet_bank().
*/
public function testGet_bank()
{
$this->assertEquals(30, $this->object->get_bank());
}
- /**
- * @covers Acc_Ledger_Fin::numb_operation
- * @todo Implement testNumb_operation().
- */
- public function testNumb_operation()
- {
- }
-
- /**
- * @covers Acc_Ledger_Fin::insert_quant_fin
- * @todo Implement testInsert_quant_fin().
- */
- public function testInsert_quant_fin()
- {
-
- }
- public function testVerify_operation()
- {
-
- }
}
- [Noalyss-commit] [noalyss] branch master updated (9e55774 -> a56f8cc), Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 02/27: Bug : fix problem with reformating number in Sales and Purchase Ledger, Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 04/27: Merge branch 'dev7103', Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 05/27: Code Cleaning : remove funciton getDefLine, Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 10/27: Acc_Ledger_History add documentation, Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 08/27: Acc_Ledger_FIN Remove DeadCode : show_ledger, Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 09/27: Test : Acc_Ledger_FIN,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 12/27: Test : Acc_Ledger_History_Financial Test : Acc_Ledger_History_Purchase Add function phpunit_page_start, Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 03/27: Merge branch 'v7110-stable', Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 01/27: documentation, Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 06/27: Code Cleaning : remove direct access to global , add Exception, Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 25/27: TEST fix bug in acc_balanceTest, Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 13/27: TEST : Acc_Ledger_History*, Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 14/27: Facility : new function to help with phpunit, Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 26/27: Documentation, Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 15/27: Facility improve page_start, Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 22/27: Merge branch 'dev-7200', Dany De Bontridder, 2019/11/02