[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 08/11: Tax Summary : test
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 08/11: Tax Summary : test |
Date: |
Fri, 25 Oct 2019 18:42:51 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 6d6b56de78f81e99bdede00c49d6c571b022c3e1
Author: Dany De Bontridder <address@hidden>
Date: Fri Oct 25 23:51:35 2019 +0200
Tax Summary : test
---
unit-test/include/class/tax_summaryTest.class.php | 164 ++++++++++++++++++++++
1 file changed, 164 insertions(+)
diff --git a/unit-test/include/class/tax_summaryTest.class.php
b/unit-test/include/class/tax_summaryTest.class.php
new file mode 100644
index 0000000..24ead32
--- /dev/null
+++ b/unit-test/include/class/tax_summaryTest.class.php
@@ -0,0 +1,164 @@
+<?php
+use PHPUnit\Framework\TestCase;
+/*
+ * This file is part of NOALYSS.
+ *
+ * PhpCompta is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * PhpCompta is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with PhpCompta; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+// Copyright (2002-2019) Author Dany De Bontridder <address@hidden>
+
+/**
+ * @file
+ * @brief
+ */
+
+class Tax_SummaryTest extends TestCase
+{
+ /**
+ * @var Acc_Account
+ */
+ protected $object;
+
+ /**
+ * Sets up the fixture, for example, opens a network connection.
+ * This method is called before a test is executed.
+ */
+ protected function setUp() :void
+ {
+ global $g_connection;
+ $this->object=new \Tax_Summary($g_connection, "01.01.2014",
"31.12.2019");
+ }
+ function testCheck()
+ {
+ // No warning expected
+ try {
+ $this->object->check();
+ $this->assertTrue(TRUE);
+ } catch(Exception $e) {
+ $this->assertSame('OK',$e->getMessage());
+ }
+ // Warning expected
+ try {
+ $this->object->set_date_start("01.01.2090");
+ $this->object->check();
+ $this->assertTrue(FALSE);
+ } catch(Exception $e) {
+ $this->assertTrue(TRUE);
+ }
+ }
+ function testDisplay()
+ {
+ $this->expectOutputRegex("/.*10\.737,34.*\<\/tr\>\<\/table\>\n/");
+ $this->object->display();
+ }
+ function testForm_export_csv()
+ {
+ $this->expectOutputRegex("/\<form method=\"GET\".*/");
+ $this->object->form_export_csv();
+ }
+ function testForm_export_pdf()
+ {
+ $this->expectOutputRegex("/\<form method=\"GET\".*/");
+ $this->object->form_export_pdf();
+ }
+ function testGet_row_purchase()
+ {
+ $array=$this->object->get_row_purchase();
+ $this->assertSame($array, [['jrn_def_name' => 'Achat',
+ 'tva_label' => '0%',
+ 'tva_rate' => '0.0000',
+ 'tva_both_side' => '0',
+ 'qp_vat_code' => '4',
+ 'amount_vat' => '0.0000',
+ 'amount_wovat' => '658.2500',
+ 'amount_sided' => '0.0000',
+ 'amount_noded_amount' => '0.0000',
+ 'amount_noded_tax' => '0.0000',
+ 'amount_noded_return' => '0.0000',
+ 'amount_private' => '0.0000'
+ ],[
+ 'jrn_def_name' => 'Achat',
+ 'tva_label' => '12%',
+ 'tva_rate' => '0.1200',
+ 'tva_both_side' => '0',
+ 'qp_vat_code' => '2',
+ 'amount_vat' => '84.2200',
+ 'amount_wovat' => '701.7800',
+ 'amount_sided' => '0.0000',
+ 'amount_noded_amount' => '0.0000',
+ 'amount_noded_tax' => '0.0000',
+ 'amount_noded_return' => '0.0000',
+ 'amount_private' => '0.0000']]);
+ }
+ function testGet_row_sale()
+ {
+ $array=$this->object->get_row_sale();
+ $this->assertSame($array, [[
+ 'jrn_def_name' => 'Vente',
+ 'tva_label' => '21%',
+ 'qs_vat_code' => '1',
+ 'tva_rate' => '0.2100',
+ 'tva_both_side' => '0',
+ 'amount_vat' => '2254.8400',
+ 'amount_wovat' => '10737.3400',
+ 'amount_sided' => '0.0000'
+ ]]);
+
+ }
+ function testget_summary_purchase()
+ {
+ $array=$this->object->get_summary_purchase();
+ $this->assertSame($array,[[
+ 'tva_label' => '0%'
+ ,'tva_rate' => '0.0000'
+ ,'tva_both_side' => '0'
+ ,'qp_vat_code' => '4'
+ ,'amount_vat' => '0.0000'
+ ,'amount_wovat' => '658.2500'
+ ,'amount_sided' => '0.0000'
+ ,'amount_noded_amount' => '0.0000'
+ ,'amount_noded_tax' => '0.0000'
+ ,'amount_noded_return' => '0.0000'
+ ,'amount_private' => '0.0000'
+ ],[
+ 'tva_label' => '12%'
+ ,'tva_rate' => '0.1200'
+ ,'tva_both_side' => '0'
+ ,'qp_vat_code' => '2'
+ ,'amount_vat' => '84.2200'
+ ,'amount_wovat' => '701.7800'
+ ,'amount_sided' => '0.0000'
+ ,'amount_noded_amount' => '0.0000'
+ ,'amount_noded_tax' => '0.0000'
+ ,'amount_noded_return' => '0.0000'
+ ,'amount_private' => '0.0000'
+ ]]);
+
+ }
+ function testget_summary_sale()
+ {
+ $array=$this->object->get_summary_sale();
+ $this->assertSame($array, [[
+ 'tva_label' => '21%',
+ 'qs_vat_code' => '1',
+ 'tva_rate' => '0.2100',
+ 'tva_both_side' => '0',
+ 'amount_vat' => '2254.8400',
+ 'amount_wovat' => '10737.3400',
+ 'amount_sided' => '0.0000'
+ ]]);
+ }
+
+}
\ No newline at end of file
- [Noalyss-commit] [noalyss] branch master updated (1710281 -> 0af1b71), Dany De Bontridder, 2019/10/25
- [Noalyss-commit] [noalyss] 02/11: PHPUNIT : add test folder, Dany De Bontridder, 2019/10/25
- [Noalyss-commit] [noalyss] 01/11: esthetic correct position for forgotten password, Dany De Bontridder, 2019/10/25
- [Noalyss-commit] [noalyss] 04/11: Fix bug in export_poste_csv, Dany De Bontridder, 2019/10/25
- [Noalyss-commit] [noalyss] 07/11: Task #1763: PRINTTVA export PDF , achat colonnes manquantes, Dany De Bontridder, 2019/10/25
- [Noalyss-commit] [noalyss] 06/11: Protect global, Dany De Bontridder, 2019/10/25
- [Noalyss-commit] [noalyss] 10/11: New = #1765: Permettre les opérations mathématiques dans les champs numériques, Dany De Bontridder, 2019/10/25
- [Noalyss-commit] [noalyss] 08/11: Tax Summary : test,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 05/11: Task #0001764 : Amount , sign equals, Dany De Bontridder, 2019/10/25
- [Noalyss-commit] [noalyss] 09/11: Task #1761: Faire apparaître le moyen de paiement, Dany De Bontridder, 2019/10/25
- [Noalyss-commit] [noalyss] 03/11: PHPUNIT : acc_balance, Dany De Bontridder, 2019/10/25
- [Noalyss-commit] [noalyss] 11/11: Merge branch 'dev7102', Dany De Bontridder, 2019/10/25