[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 13/27: TEST : Acc_Ledger_History*
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 13/27: TEST : Acc_Ledger_History* |
Date: |
Sat, 2 Nov 2019 18:12:17 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 834c025e601a3b77e966826a8a6acdd059c4e161
Author: Dany De Bontridder <address@hidden>
Date: Sat Nov 2 15:09:55 2019 +0100
TEST : Acc_Ledger_History*
---
.../class/acc_ledger_history_genericTest.class.php | 117 +++++++++++++++++++++
.../acc_ledger_history_purchaseTest.class.php | 45 +++++++-
.../class/acc_ledger_history_saleTest.class.php | 53 ++++++++++
3 files changed, 211 insertions(+), 4 deletions(-)
diff --git a/unit-test/include/class/acc_ledger_history_genericTest.class.php
b/unit-test/include/class/acc_ledger_history_genericTest.class.php
new file mode 100644
index 0000000..fa84e9e
--- /dev/null
+++ b/unit-test/include/class/acc_ledger_history_genericTest.class.php
@@ -0,0 +1,117 @@
+<?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 concerne acc_ledger_history_generic.class
+ */
+class Acc_Ledger_History_GenericTest extends TestCase
+{
+
+ /**
+ * @var
+ */
+ protected $object;
+
+ /**
+ * Sets up the fixture, for example, opens a network connection.
+ * This method is called before a test is executed.
+ */
+ protected function setUp()
+ {
+ include 'global.php';
+ global $g_connection;
+ $this->object=new acc_ledger_history_generic($g_connection, [2], 92,
131, 'L');
+ }
+
+ /**
+ * Tears down the fixture, for example, closes a network connection.
+ * This method is called after a test is executed.
+ */
+ protected function tearDown()
+ {
+
+ }
+
+ function testGet_row()
+ {
+ $this->object->get_row();
+ $this->assertSame(count($this->object->get_data()), 3);
+ }
+
+ private function save_file($p_name, $content)
+ {
+ $hFile=fopen(__DIR__."/file/".$p_name, "w+");
+ fwrite($hFile, $content);
+ fclose($hFile);
+ }
+
+ //@covers Acc_Ledger_History_Generic::export_oneline_html
+ function testExport_Oneline_Html()
+ {
+ //- Listing
+ $name="acc_ledger_history_Generic_export_listing.html";
+ $this->object->set_m_mode("L");
+ ob_start();
+ phpunit_page_start();
+ $this->object->export_html();
+ $content=ob_get_contents();
+
+ $this->save_file($name, $content);
+ $this->assertFileExists(__DIR__."/file/".$name);
+
+ //- Extended
+ $name="acc_ledger_history_Generic_export_extended.html";
+ $this->object->set_m_mode("E");
+ ob_start();
+ phpunit_page_start();
+ $this->object->export_html();
+ $content=ob_get_contents();
+
+ $this->save_file($name, $content);
+ $this->assertFileExists(__DIR__."/file/".$name);
+
+ //- Detail
+ $name="acc_ledger_history_Generic_export_detail.html";
+ $this->object->set_m_mode("D");
+ ob_start();
+ phpunit_page_start();
+ $this->object->export_html();
+ $content=ob_get_contents();
+
+ $this->save_file($name, $content);
+ $this->assertFileExists(__DIR__."/file/".$name);
+
+ //- Accounting
+ $name="acc_ledger_history_Generic_export_accounting.html";
+ $this->object->set_m_mode("D");
+ ob_start();
+ phpunit_page_start();
+ $this->object->export_html();
+ $content=ob_get_contents();
+
+ $this->save_file($name, $content);
+ $this->assertFileExists(__DIR__."/file/".$name);
+ }
+
+}
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 a54d093..2ec6cad 100644
--- a/unit-test/include/class/acc_ledger_history_purchaseTest.class.php
+++ b/unit-test/include/class/acc_ledger_history_purchaseTest.class.php
@@ -68,12 +68,49 @@ class Acc_Ledger_History_PurchaseTest extends TestCase
//@covers Acc_Ledger_History_Financial::export_oneline_html
function testExport_Oneline_Html()
{
+ //- Listing
+ $name="acc_ledger_history_purchase_export_listing.html";
+ $this->object->set_m_mode("L");
ob_start();
- $this->object->export_accounting_html();
- $content=ob_get_flush();
- $this->save_file("acc_ledger_history_purchase_oneline.html",$content);
-
$this->assertFileExists(__DIR__."/file/"."acc_ledger_history_purchase_oneline.html");
+ phpunit_page_start();
+ $this->object->export_html();
+ $content=ob_get_contents();
+ $this->save_file($name, $content);
+ $this->assertFileExists(__DIR__."/file/".$name);
+
+ //- Extended
+ $name="acc_ledger_history_purchase_export_extended.html";
+ $this->object->set_m_mode("E");
+ ob_start();
+ phpunit_page_start();
+ $this->object->export_html();
+ $content=ob_get_contents();
+
+ $this->save_file($name, $content);
+ $this->assertFileExists(__DIR__."/file/".$name);
+
+ //- Detail
+ $name="acc_ledger_history_purchase_export_detail.html";
+ $this->object->set_m_mode("D");
+ ob_start();
+ phpunit_page_start();
+ $this->object->export_html();
+ $content=ob_get_contents();
+
+ $this->save_file($name, $content);
+ $this->assertFileExists(__DIR__."/file/".$name);
+
+ //- Accounting
+ $name="acc_ledger_history_purchase_export_accounting.html";
+ $this->object->set_m_mode("D");
+ ob_start();
+ phpunit_page_start();
+ $this->object->export_html();
+ $content=ob_get_contents();
+
+ $this->save_file($name, $content);
+ $this->assertFileExists(__DIR__."/file/".$name);
}
}
diff --git a/unit-test/include/class/acc_ledger_history_saleTest.class.php
b/unit-test/include/class/acc_ledger_history_saleTest.class.php
index 6197445..468731d 100644
--- a/unit-test/include/class/acc_ledger_history_saleTest.class.php
+++ b/unit-test/include/class/acc_ledger_history_saleTest.class.php
@@ -57,4 +57,57 @@ class Acc_Ledger_History_SaleTest extends TestCase
$this->object->get_row();
$this->assertSame(count($this->object->get_data()),4);
}
+ private function save_file($p_name,$content)
+ {
+ $hFile=fopen(__DIR__."/file/".$p_name,"w+");
+ fwrite($hFile, $content);
+ fclose($hFile);
+ }
+ //@covers Acc_Ledger_History_Sale::export_oneline_html
+ function testExport_Oneline_Html()
+ {
+ //- Listing
+ $name="acc_ledger_history_sale_export_listing.html";
+ $this->object->set_m_mode("L");
+ ob_start();
+ phpunit_page_start();
+ $this->object->export_html();
+ $content=ob_get_contents();
+
+ $this->save_file($name, $content);
+ $this->assertFileExists(__DIR__."/file/".$name);
+
+ //- Extended
+ $name="acc_ledger_history_sale_export_extended.html";
+ $this->object->set_m_mode("E");
+ ob_start();
+ phpunit_page_start();
+ $this->object->export_html();
+ $content=ob_get_contents();
+
+ $this->save_file($name, $content);
+ $this->assertFileExists(__DIR__."/file/".$name);
+
+ //- Detail
+ $name="acc_ledger_history_sale_export_detail.html";
+ $this->object->set_m_mode("D");
+ ob_start();
+ phpunit_page_start();
+ $this->object->export_html();
+ $content=ob_get_contents();
+
+ $this->save_file($name, $content);
+ $this->assertFileExists(__DIR__."/file/".$name);
+
+ //- Accounting
+ $name="acc_ledger_history_sale_export_accounting.html";
+ $this->object->set_m_mode("D");
+ ob_start();
+ phpunit_page_start();
+ $this->object->export_html();
+ $content=ob_get_contents();
+
+ $this->save_file($name, $content);
+ $this->assertFileExists(__DIR__."/file/".$name);
+ }
}
- [Noalyss-commit] [noalyss] 04/27: Merge branch 'dev7103', (continued)
- [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, 2019/11/02
- [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 <=
- [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, 2019/11/02