[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 20/27: TEST : update
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 20/27: TEST : update |
Date: |
Sat, 2 Nov 2019 18:12:19 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit b26e377c58c97040b8d3d1a053f4927294e711e3
Author: Dany De Bontridder <address@hidden>
Date: Sat Nov 2 21:09:58 2019 +0100
TEST : update
---
unit-test/include/class/acc_balanceTest.class.php | 4 +-
unit-test/include/class/acc_computeTest.class.php | 148 +++++++++++++++++++--
.../acc_ledger_history_financialTest.class.php | 2 +-
.../acc_ledger_history_purchaseTest.class.php | 2 +-
.../include/class/acc_ledger_soldTest.class.php | 2 +-
.../include/class/anc_grandlivreTest.class.php | 9 +-
.../class/noalyss_parameter_folderTest.class.php | 1 +
7 files changed, 148 insertions(+), 20 deletions(-)
diff --git a/unit-test/include/class/acc_balanceTest.class.php
b/unit-test/include/class/acc_balanceTest.class.php
index 915242d..c548605 100644
--- a/unit-test/include/class/acc_balanceTest.class.php
+++ b/unit-test/include/class/acc_balanceTest.class.php
@@ -48,10 +48,10 @@ class Acc_BalanceTest extends TestCase
$min=$g_connection->get_value("select min(p_id) from parm_periode");
$this->object->jrn=NULL;
$array=$this->object->get_row($min,$max);
- $this->assertEquals(14,count($array));
+ $this->assertEquals(29,count($array));
$this->object->jrn=[2,4];
$array=$this->object->get_row($min,$max);
- $this->assertEquals(7,count($array));
+ $this->assertEquals(10,count($array));
}
diff --git a/unit-test/include/class/acc_computeTest.class.php
b/unit-test/include/class/acc_computeTest.class.php
index 09b9386..21bc12f 100644
--- a/unit-test/include/class/acc_computeTest.class.php
+++ b/unit-test/include/class/acc_computeTest.class.php
@@ -186,19 +186,149 @@ class Acc_ComputeTest extends TestCase
{
ob_start();
$this->object->display();
- $result= ob_get_flush();
+ $result=ob_get_contents();
$this->assertStringStartsWith("key amount Description amount value is
0<br>key amount_vat Description amount_vat value is 0<br>",$result);
$this->assertStringEndsWith("<br>key amount_perso_rate Description
amount_perso_rate value is 0<br>",$result);
}
- /**
- * @covers Acc_Compute::test_me
- * @todo Implement testTest_me().
- */
- public function testTest_me()
+ public function testCompute()
{
- $this->object->test_me();
- $this->assertTrue(true,true);
- }
+ $a=new Acc_Compute();
+ // Compute some operation to see if the computed amount are
+ // correct
+
+ //Test VAT
+ $a->set_parameter('amount',1.23);
+ $a->set_parameter('amount_vat_rate',0.21);
+
+ $a->compute_vat();
+ $this->assertEquals($a->amount_vat,0.26);
+ try
+ {
+ $a->verify();
+ $this->assertTrue(TRUE);
+ }
+ catch (Exception $exc)
+ {
+ echo $exc->getMessage();
+ error_log($exc->getTraceAsString());
+ $this->assertTrue(FALSE);
+ }
+
+
+
+ // Test VAT + perso
+ $a=new Acc_Compute();
+ $a->set_parameter('amount',1.23);
+ $a->set_parameter('amount_vat_rate',0.21);
+ $a->set_parameter('amount_perso_rate',0.5);
+ $b=clone $a;
+ $a->compute_vat();
+ $this->assertEquals($a->amount_vat,0.26);
+ $a->compute_perso();
+ $this->assertEquals($a->amount_perso,0.01);
+ $a->correct();
+ $this->assertEquals($a->amount_vat,0.26);
+ $this->assertEquals($a->amount_perso,0.01);
+
+ $a->verify($b);
+
+ // TEST VAT + ND
+ // Test VAT + perso
+ $a=new Acc_Compute();
+ $a->set_parameter('amount',1.23);
+ $a->set_parameter('amount_vat_rate',0.21);
+ $a->set_parameter('nd_vat_rate',0.5);
+ $b=clone $a;
+ echo '<h1> Test VAT + ND VAT</h1>';
+ echo '<h2> Data </h2>';
+ $a->display();
+ $a->compute_vat();
+ $a->compute_nd_vat();
+ $a->correct();
+ echo '<h2> Result </h2>';
+ $a->display();
+ $a->verify($b);
+ // TEST VAT + ND
+ // Test VAT + perso
+ $a=new Acc_Compute();
+ $a->set_parameter('amount',1.23);
+ $a->set_parameter('amount_vat_rate',0.21);
+ $a->set_parameter('nd_vat_rate',0.5);
+ $a->set_parameter('amount_perso_rate',0.5);
+
+ $b=clone $a;
+ echo '<h1> Test VAT + ND VAT + perso</h1>';
+ echo '<h2> Data </h2>';
+ $a->display();
+ $a->compute_vat();
+ $a->compute_perso();
+ $a->compute_nd_vat();
+ $a->correct();
+ echo '<h2> Result </h2>';
+ $a->display();
+ $a->verify($b);
+ // TEST VAT + ND
+ $a=new Acc_Compute();
+ $a->set_parameter('amount',1.23);
+ $a->set_parameter('amount_vat_rate',0.21);
+ $a->set_parameter('amount_nd_rate',0.5);
+
+ $b=clone $a;
+ echo '<h1> Test VAT + ND </h1>';
+ echo '<h2> Data </h2>';
+ $a->display();
+ $a->compute_vat();
+ $a->compute_nd();
+
+ $a->compute_perso();
+ $a->compute_nd_vat();
+ $a->correct();
+ echo '<h2> Result </h2>';
+ $a->display();
+ $a->verify($b);
+ // TEST VAT + ND
+ // + Perso
+ $a=new Acc_Compute();
+ $a->set_parameter('amount',1.23);
+ $a->set_parameter('amount_vat_rate',0.21);
+ $a->set_parameter('amount_nd_rate',0.5);
+ $a->set_parameter('amount_perso_rate',0.2857);
+ $b=clone $a;
+ echo '<h1> Test VAT + ND + Perso</h1>';
+ echo '<h2> Data </h2>';
+ $a->display();
+ $a->compute_vat();
+ $a->compute_nd();
+
+ $a->compute_perso();
+ $a->compute_nd_vat();
+ $a->correct();
+ echo '<h2> Result </h2>';
+ $a->display();
+ $a->verify($b);
+// TEST VAT + ND
+ // + Perso
+ $a=new Acc_Compute();
+ $a->set_parameter('amount',1.23);
+ $a->set_parameter('amount_vat_rate',0.21);
+ $a->set_parameter('nd_ded_vat_rate',0.5);
+
+ $b=clone $a;
+ echo '<h1> Test VAT + TVA ND DED</h1>';
+ echo '<h2> Data </h2>';
+ $a->display();
+ $a->compute_vat();
+ $a->compute_nd();
+
+ $a->compute_perso();
+ $a->compute_nd_vat();
+ $a->compute_ndded_vat();
+ $a->correct();
+ echo '<h2> Result </h2>';
+ $a->display();
+ $a->verify($b);
+ }
+
}
diff --git a/unit-test/include/class/acc_ledger_history_financialTest.class.php
b/unit-test/include/class/acc_ledger_history_financialTest.class.php
index 058b89f..7e55654 100644
--- a/unit-test/include/class/acc_ledger_history_financialTest.class.php
+++ b/unit-test/include/class/acc_ledger_history_financialTest.class.php
@@ -63,7 +63,7 @@ class Acc_Ledger_History_FinancialTest extends TestCase
function testGet__row()
{
$this->object->get_row();
- $this->assertEquals(1, count($this->object->get_data()));
+ $this->assertEquals(5, count($this->object->get_data()));
}
//@covers Acc_Ledger_History_Financial::export_html
diff --git a/unit-test/include/class/acc_ledger_history_purchaseTest.class.php
b/unit-test/include/class/acc_ledger_history_purchaseTest.class.php
index de8485e..cead9a3 100644
--- a/unit-test/include/class/acc_ledger_history_purchaseTest.class.php
+++ b/unit-test/include/class/acc_ledger_history_purchaseTest.class.php
@@ -62,7 +62,7 @@ class Acc_Ledger_History_PurchaseTest extends TestCase
function testGet_Row()
{
$this->object->get_row();
- $this->assertSame(count($this->object->get_data()),2);
+ $this->assertSame(count($this->object->get_data()),65);
}
//@covers Acc_Ledger_History_Financial::export_oneline_html
diff --git a/unit-test/include/class/acc_ledger_soldTest.class.php
b/unit-test/include/class/acc_ledger_soldTest.class.php
index ec31e9d..1ce4824 100644
--- a/unit-test/include/class/acc_ledger_soldTest.class.php
+++ b/unit-test/include/class/acc_ledger_soldTest.class.php
@@ -39,7 +39,7 @@ class Acc_Ledger_SoldTest extends TestCase
"action"=>"use_opd",
"jrn_type"=>"VEN",
"filter"=>"",
- "e_date"=>"24.04.2018",
+ "e_date"=>"24.08.2019",
"e_ech"=>"",
"e_client"=>"CLIENT",
"e_pj"=>"VEN10",
diff --git a/unit-test/include/class/anc_grandlivreTest.class.php
b/unit-test/include/class/anc_grandlivreTest.class.php
index d90d93e..f43d226 100644
--- a/unit-test/include/class/anc_grandlivreTest.class.php
+++ b/unit-test/include/class/anc_grandlivreTest.class.php
@@ -18,7 +18,8 @@ class Anc_GrandLivreTest extends TestCase
*/
protected function setUp()
{
- $this->object=new Anc_GrandLivre;
+ global $g_connection;
+ $this->object=new Anc_GrandLivre($g_connection);
}
/**
@@ -32,14 +33,10 @@ class Anc_GrandLivreTest extends TestCase
/**
* @covers Anc_GrandLivre::set_sql_filter
- * @todo Implement testSet_sql_filter().
*/
public function testSet_sql_filter()
{
- // Remove the following lines when you implement this test.
- $this->markTestIncomplete(
- 'This test has not been implemented yet.'
- );
+
}
/**
diff --git a/unit-test/include/class/noalyss_parameter_folderTest.class.php
b/unit-test/include/class/noalyss_parameter_folderTest.class.php
index 091830c..ca37a58 100644
--- a/unit-test/include/class/noalyss_parameter_folderTest.class.php
+++ b/unit-test/include/class/noalyss_parameter_folderTest.class.php
@@ -65,6 +65,7 @@ class Noalyss_Parameter_FolderTest extends TestCase
"MY_DATE_SUGGEST,".
"MY_ALPHANUM,".
"MY_UPDLAB,".
+ "MY_ANC_FILTER,".
"MY_STOCK");
}
- [Noalyss-commit] [noalyss] 13/27: TEST : Acc_Ledger_History*, (continued)
- [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
- [Noalyss-commit] [noalyss] 21/27: Bug : export PDF for PRINTTVA doesn't print all the ledgers, Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 17/27: Documentation, Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 07/27: TEST : add new files, Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 19/27: PRINTTVA : cosmetic bug, Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 27/27: Merge branch 'dev-7200', Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 20/27: TEST : update,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 16/27: TEST : Acc_Ledger_Purchase + Acc_Ledger_Sale, Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 24/27: Documentation, Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 23/27: TEST fix bug in acc_balanceTest, Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 11/27: Acc_Ledger_History : add documentation, Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 18/27: TEST, Dany De Bontridder, 2019/11/02