[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 12/27: Test : Acc_Ledger_History_Financial Te
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 12/27: Test : Acc_Ledger_History_Financial Test : Acc_Ledger_History_Purchase Add function phpunit_page_start |
Date: |
Sat, 2 Nov 2019 18:12:17 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit e9931f80afa77e822a60f9ae495d57840c0a91bb
Author: Dany De Bontridder <address@hidden>
Date: Sat Nov 2 14:57:03 2019 +0100
Test : Acc_Ledger_History_Financial
Test : Acc_Ledger_History_Purchase
Add function phpunit_page_start
---
unit-test/global.php | 24 ++++++++++++
... => acc_ledger_history_financialTest.class.php} | 45 +++++++++++++++++++---
.../acc_ledger_history_purchaseTest.class.php | 18 +++++++++
3 files changed, 82 insertions(+), 5 deletions(-)
diff --git a/unit-test/global.php b/unit-test/global.php
index 1296166..a01c85a 100644
--- a/unit-test/global.php
+++ b/unit-test/global.php
@@ -33,3 +33,27 @@ $_SESSION['g_user']='admin';
$_SESSION['g_pass']='phpcompta';
$_SESSION['g_pagesize']='50';
$g_user=new User($g_connection);
+
+if ( !function_exists("phpunit_page_start"))
+{
+function phpunit_page_start()
+{
+ $noalyss_home=NOALYSS_HOME;
+ echo <<<EOF
+ <!doctype html>
+<HTML><HEAD><meta charset="utf-8"><META http-equiv="Content-Type"
content="text/html; charset=UTF-8">
+ <TITLE>PRINTJRN NOALYSS</TITLE>
+ <link rel="icon" type="image/ico" href="favicon.ico" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <LINK id="pagestyle" REL="stylesheet" type="text/css"
href="{$noalyss_home}/style-classic7.css?version=7105" media="screen"/>
+ <link rel="stylesheet" type="text/css"
href="./style-print.css?version=7105" media="print"/>
+ <script language="javascript" src="js/calendar.js"></script>
+ <script type="text/javascript" src="js/lang/calendar-en.js"></script>
+ <script language="javascript" src="js/calendar-setup.js"></script>
+ <LINK REL="stylesheet" type="text/css" href="calendar-blue.css"
media="screen">
+ </HEAD>
+ <body>
+ <div class="content">
+EOF;
+}
+}
\ No newline at end of file
diff --git a/unit-test/include/class/acc_ledger_history_purchaseTest.class.php
b/unit-test/include/class/acc_ledger_history_financialTest.class.php
similarity index 51%
copy from unit-test/include/class/acc_ledger_history_purchaseTest.class.php
copy to unit-test/include/class/acc_ledger_history_financialTest.class.php
index d9a88d5..1d7d754 100644
--- a/unit-test/include/class/acc_ledger_history_purchaseTest.class.php
+++ b/unit-test/include/class/acc_ledger_history_financialTest.class.php
@@ -23,9 +23,9 @@ use PHPUnit\Framework\TestCase;
/**
* @file
- * @brief concerne acc_ledger_history_purchaseTest.class
+ * @brief concerne acc_ledger_history_financialTest.class
*/
-class Acc_Ledger_History_PurchaseTest extends TestCase
+class Acc_Ledger_History_FinancialTest extends TestCase
{
/**
@@ -41,7 +41,7 @@ class Acc_Ledger_History_PurchaseTest extends TestCase
{
include 'global.php';
global $g_connection;
- $this->object=new Acc_Ledger_History_Purchase($g_connection, [3], 92,
131, 'L');
+ $this->object=new Acc_Ledger_History_Financial($g_connection, [1], 92,
131, 'E');
}
/**
@@ -52,10 +52,45 @@ class Acc_Ledger_History_PurchaseTest extends TestCase
{
}
- function testGet_Row()
+
+ private function save_file($p_name, $content)
+ {
+ $hFile=fopen(__DIR__."/file/".$p_name,"w+");
+ fwrite($hFile, $content);
+ fclose($hFile);
+ }
+
+ function testGet__row()
{
$this->object->get_row();
- $this->assertSame(count($this->object->get_data()),2);
+ $this->assertEquals(1, count($this->object->get_data()));
+ }
+ //@covers Acc_Ledger_History_Financial::export_html
+ //@covers Acc_Ledger_History_Financial::export_accounting_html
+ function testExport_Html()
+ {
+ //- Listing
+ $name="acc_ledger_history_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);
+
+ //- Listing
+ $name="acc_ledger_history_export_accounting.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);
+
}
}
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 d9a88d5..a54d093 100644
--- a/unit-test/include/class/acc_ledger_history_purchaseTest.class.php
+++ b/unit-test/include/class/acc_ledger_history_purchaseTest.class.php
@@ -52,10 +52,28 @@ class Acc_Ledger_History_PurchaseTest extends TestCase
{
}
+ private function save_file($p_name,$content)
+ {
+ $hFile=fopen(__DIR__."/file/".$p_name,"w+");
+ fwrite($hFile, $content);
+ fclose($hFile);
+ }
+ //@covers Acc_Ledger_History_Financial::get_row ,
Acc_Ledger_History_Financial::get_data
function testGet_Row()
{
$this->object->get_row();
$this->assertSame(count($this->object->get_data()),2);
}
+ //@covers Acc_Ledger_History_Financial::export_oneline_html
+ function testExport_Oneline_Html()
+ {
+ 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");
+
+ }
+
}
- [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, 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 <=
- [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
- [Noalyss-commit] [noalyss] 21/27: Bug : export PDF for PRINTTVA doesn't print all the ledgers, Dany De Bontridder, 2019/11/02