Merge branch 'dev-7200' into entreprise
This commit is contained in:
commit
80e18cf29e
39 changed files with 2124 additions and 942 deletions
|
|
@ -298,8 +298,9 @@ class Acc_Balance
|
|||
|
||||
}
|
||||
/**
|
||||
* set the $this->jrn to the cat
|
||||
* @todo Cette function semble ne pas fonctionner correctement
|
||||
* set the $this->jrn to the cat, filter the ledger thanks the type (key in the array)
|
||||
* @param array of integer 0->Sale,1->Purchase,2->Financial,3->ODS
|
||||
* @see Acc_Ledgger::array_cat
|
||||
*/
|
||||
function filter_cat($p_array)
|
||||
{
|
||||
|
|
@ -448,14 +449,5 @@ class Acc_Balance
|
|||
$p_pdf->write_cell(10,6,$side);
|
||||
$p_pdf->line_new();
|
||||
}
|
||||
static function test_me ()
|
||||
{
|
||||
require 'class/user.class.php';
|
||||
global $g_user;
|
||||
$cn=Dossier::connect();
|
||||
$g_user=new User($cn);
|
||||
$a=new Acc_Balance($cn);
|
||||
$a->get_row(163, 175, 1);
|
||||
var_dump($a);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -461,22 +461,6 @@ class Acc_Ledger extends jrn_def_sql
|
|||
return $Res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the number of lines of a journal
|
||||
* @param$p_cred deb or cred
|
||||
*
|
||||
* \return an integer
|
||||
*/
|
||||
function GetDefLine()
|
||||
{
|
||||
$sql_cred='jrn_deb_max_line';
|
||||
$sql="select jrn_deb_max_line as value from jrn_def where jrn_def_id=$1";
|
||||
$r=$this->db->exec_sql($sql, array($this->id));
|
||||
$Res=Database::fetch_all($r);
|
||||
if ($Res == FALSE || sizeof($Res)==0)
|
||||
return 1;
|
||||
return $Res[0]['value'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get the saldo of a ledger for a specific period
|
||||
|
|
@ -1155,7 +1139,11 @@ class Acc_Ledger extends jrn_def_sql
|
|||
*/
|
||||
if ($this->check_periode()==false||!isset($p_array['period']))
|
||||
{
|
||||
$periode->find_periode($e_date);
|
||||
try {
|
||||
$periode->find_periode($e_date);
|
||||
} catch (Exception $e) {
|
||||
throw new Exception(_("Période inexistante"), 6, $e);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -2759,7 +2747,7 @@ class Acc_Ledger extends jrn_def_sql
|
|||
/* Numbering (only FIN) */
|
||||
$num_op=new ICheckBox('numb_operation');
|
||||
echo dossier::hidden();
|
||||
echo HtmlInput::hidden('ac', $_REQUEST['ac']);
|
||||
echo HtmlInput::hidden('ac', $http->request('ac'));
|
||||
echo $hidden;
|
||||
|
||||
$cn=$this->db;
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ class Acc_Ledger_Fin extends Acc_Ledger
|
|||
}
|
||||
$nb++;
|
||||
}
|
||||
if ($nb == 0)
|
||||
if ($nb == 0)
|
||||
throw new Exception('Il n\'y a aucune opération', 12);
|
||||
|
||||
/* Check if the last_saldo and first_saldo are correct */
|
||||
|
|
@ -1098,119 +1098,6 @@ class Acc_Ledger_Fin extends Acc_Ledger
|
|||
return $ret;
|
||||
}
|
||||
|
||||
/**\brief display operation of a FIN ledger
|
||||
* \return html code into a string
|
||||
*/
|
||||
|
||||
function show_ledger()
|
||||
{
|
||||
global $g_user;
|
||||
echo dossier::hidden();
|
||||
$hid = new IHidden();
|
||||
|
||||
$hid->name = "p_action";
|
||||
$hid->value = "bank";
|
||||
echo $hid->input();
|
||||
|
||||
|
||||
$hid->name = "sa";
|
||||
$hid->value = "l";
|
||||
echo $hid->input();
|
||||
|
||||
|
||||
$w = new ISelect();
|
||||
// filter on the current year
|
||||
$filter_year = " where p_exercice='" . $g_user->get_exercice() . "'";
|
||||
|
||||
$periode_start = $this->db->make_array("select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_start,p_end", 1);
|
||||
// User is already set User=new User($this->db);
|
||||
$current = (isset($_GET['p_periode'])) ? $_GET['p_periode'] : -1;
|
||||
$w->selected = $current;
|
||||
|
||||
echo '<form>';
|
||||
echo 'Période ' . $w->input("p_periode", $periode_start);
|
||||
$wLedger = $this->select_ledger('fin', 3);
|
||||
|
||||
if ($wLedger == null)
|
||||
throw new Exception(_('Pas de journal disponible'));
|
||||
|
||||
if (count($wLedger->value) > 1)
|
||||
{
|
||||
$aValue = $wLedger->value;
|
||||
$wLedger->value[0] = array('value' => -1, 'label' => _('Tous les journaux financiers'));
|
||||
$idx = 1;
|
||||
foreach ($aValue as $a)
|
||||
{
|
||||
$wLedger->value[$idx] = $a;
|
||||
$idx++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
echo 'Journal ' . $wLedger->input();
|
||||
$w = new ICard();
|
||||
$w->noadd = 'no';
|
||||
$w->jrn = $this->id;
|
||||
$qcode = (isset($_GET['qcode'])) ? $_GET['qcode'] : "";
|
||||
echo dossier::hidden();
|
||||
echo HtmlInput::hidden('p_action', 'bank');
|
||||
echo HtmlInput::hidden('sa', 'l');
|
||||
$w->name = 'qcode';
|
||||
$w->value = $qcode;
|
||||
$w->label = '';
|
||||
$this->type = 'FIN';
|
||||
$all = $this->get_all_fiche_def();
|
||||
$w->extra = $all;
|
||||
$w->extra2 = 'QuickCode';
|
||||
$sp = new ISpan();
|
||||
echo $sp->input("qcode_label", "", $qcode);
|
||||
echo $w->input();
|
||||
|
||||
echo HtmlInput::submit('gl_submit', _('Rechercher'));
|
||||
echo '</form>';
|
||||
|
||||
// Show list of sell
|
||||
// Date - date of payment - Customer - amount
|
||||
if ($current != -1)
|
||||
{
|
||||
$filter_per = " and jr_tech_per=" . $current;
|
||||
}
|
||||
else
|
||||
{
|
||||
$filter_per = " and jr_tech_per in (select p_id from parm_periode where p_exercice::integer=" .
|
||||
$g_user->get_exercice() . ")";
|
||||
}
|
||||
/* security */
|
||||
if ($this->id != -1)
|
||||
$available_ledger = " and jr_def_id= " . $this->id . " and " . $g_user->get_ledger_sql();
|
||||
else
|
||||
$available_ledger = " and " . $g_user->get_ledger_sql();
|
||||
// Show list of sell
|
||||
// Date - date of payment - Customer - amount
|
||||
$sql = SQL_LIST_ALL_INVOICE . $filter_per . " and jr_def_type='FIN'" .
|
||||
" $available_ledger";
|
||||
$step = $_SESSION['g_pagesize'];
|
||||
$page = (isset($_GET['offset'])) ? $_GET['page'] : 1;
|
||||
$offset = (isset($_GET['offset'])) ? $_GET['offset'] : 0;
|
||||
|
||||
$l = "";
|
||||
|
||||
// check if qcode contains something
|
||||
if ($qcode != "")
|
||||
{
|
||||
// add a condition to filter on the quick code
|
||||
$l = " and jr_grpt_id in (select j_grpt from jrnx where j_qcode=upper('$qcode')) ";
|
||||
}
|
||||
|
||||
list($max_line, $list) = ListJrn($this->db, "where jrn_def_type='FIN' $filter_per $l $available_ledger "
|
||||
, null, $offset, 0);
|
||||
$bar = navigation_bar($offset, $max_line, $step, $page);
|
||||
|
||||
echo "<hr> $bar";
|
||||
echo $list;
|
||||
echo "$bar <hr>";
|
||||
}
|
||||
|
||||
/**
|
||||
* return a string with the bank account, name and quick_code
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/***
|
||||
* @file
|
||||
* @brief Display history of operation
|
||||
* @brief display or export operations in HTML , PDF or CSV
|
||||
*
|
||||
*/
|
||||
require_once NOALYSS_INCLUDE."/class/acc_ledger_history_generic.class.php";
|
||||
|
|
@ -42,6 +42,15 @@ abstract class Acc_Ledger_History
|
|||
protected $m_mode; //!< mode of export L : one line, E accounting writing , D : Detail
|
||||
public $db; //!< database connx
|
||||
|
||||
/**
|
||||
*
|
||||
* @param Database $cn
|
||||
* @param array $pa_ledger array of jrn_def.jrn_def_id
|
||||
* @param integer $p_from periode
|
||||
* @param integer $p_to
|
||||
* @param char $p_mode E D L or A , for Extended ,Detail , Listing , Accounting
|
||||
* @throws Exception if $pa_ledger is not an array
|
||||
*/
|
||||
function __construct(Database $cn, $pa_ledger, $p_from, $p_to, $p_mode)
|
||||
{
|
||||
if (is_array($pa_ledger) == FALSE) {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
/**
|
||||
* @file
|
||||
* @brief displya financial operations
|
||||
* @brief display financial operations in HTML , PDF or CSV
|
||||
*
|
||||
*/
|
||||
require_once NOALYSS_INCLUDE."/class/acc_ledger_history.class.php";
|
||||
|
|
|
|||
|
|
@ -806,9 +806,6 @@ class Acc_Ledger_History_Generic extends Acc_Ledger_History
|
|||
if (count($this->data)==0)
|
||||
exit;
|
||||
$old_id="";
|
||||
/**
|
||||
* @todo add table headers
|
||||
*/
|
||||
foreach ($this->data[0] as $idx=>$op)
|
||||
{
|
||||
// should clean description : remove <b><i> tag and '; char
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
/**
|
||||
* @file
|
||||
* @brief class Acc_Ledger_History_Purchase , list of operations
|
||||
* * display or export operations in HTML , PDF or CSV
|
||||
*/
|
||||
require_once NOALYSS_INCLUDE."/class/acc_ledger_history.class.php";
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
/**
|
||||
* @file
|
||||
* @brief Acc_Ledger_History : Manage the list (history) of operations for display
|
||||
* display or export operations in HTML , PDF or CSV
|
||||
*/
|
||||
require_once NOALYSS_INCLUDE."/class/acc_ledger_history.class.php";
|
||||
|
||||
|
|
|
|||
|
|
@ -199,20 +199,4 @@ class Acc_Ledger_Info
|
|||
$this->insert();
|
||||
}
|
||||
}
|
||||
static function test_me()
|
||||
{
|
||||
echo "Dossier = ".Dossier::id();
|
||||
$cn=Dossier::connect();
|
||||
$a=new Acc_Ledger_Info($cn);
|
||||
$a->jr_id=3;
|
||||
$a->id_type='BON_COMMANDE';
|
||||
$a->ji_value='BON';
|
||||
var_dump($a);
|
||||
$a->insert();
|
||||
|
||||
$a->set_jrn_id(7);
|
||||
$a->set_type('OTHER');
|
||||
$a->set_value('Autre test');
|
||||
$a->insert();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1171,44 +1171,7 @@ EOF;
|
|||
return $r;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief update the payment
|
||||
* @deprecated
|
||||
*
|
||||
*/
|
||||
|
||||
function show_unpaid() {
|
||||
// Show list of unpaid sell
|
||||
// Date - date of payment - Customer - amount
|
||||
// Nav. bar
|
||||
$step = $_SESSION['g_pagesize'];
|
||||
$page = (isset($_GET['offset'])) ? $_GET['page'] : 1;
|
||||
$offset = (isset($_GET['offset'])) ? $_GET['offset'] : 0;
|
||||
|
||||
|
||||
$sql = SQL_LIST_UNPAID_INVOICE_DATE_LIMIT . " and jr_def_id=" . $this->id;
|
||||
list($max_line, $list) = ListJrn($this->db, $sql, null, $offset, 1);
|
||||
$sql = SQL_LIST_UNPAID_INVOICE . " and jr_def_id=" . $this->id;
|
||||
list($max_line2, $list2) = ListJrn($this->db, $sql, null, $offset, 1);
|
||||
|
||||
// Get the max line
|
||||
$m = ($max_line2 > $max_line) ? $max_line2 : $max_line;
|
||||
$bar2 = navigation_bar($offset, $m, $step, $page);
|
||||
|
||||
echo $bar2;
|
||||
echo '<h2 class="info"> ' . _('Echeance dépassée') . ' </h2>';
|
||||
echo $list;
|
||||
echo '<h2 class="info"> ' . _('Non Payée') . ' </h2>';
|
||||
echo $list2;
|
||||
echo $bar2;
|
||||
// Add hidden parameter
|
||||
$hid = new IHidden();
|
||||
|
||||
echo '<hr>';
|
||||
|
||||
if ($m != 0)
|
||||
echo HtmlInput::submit('paid', _('Mise à jour paiement'));
|
||||
}
|
||||
|
||||
|
||||
/*!\brief display the form for entering data for invoice,
|
||||
* \param $p_array is null or you can put the predef operation or the $_POST
|
||||
|
|
@ -1616,14 +1579,7 @@ EOF;
|
|||
return $array;
|
||||
}
|
||||
|
||||
/*!\brief test function
|
||||
*/
|
||||
|
||||
static function test_me($p_string = '') {
|
||||
$cn = Dossier::connect();
|
||||
$a = new Acc_Ledger_Sold($cn, 2);
|
||||
echo $a->input();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ class Pre_op_ven extends Pre_operation_detail
|
|||
// Find the ledger
|
||||
$ledger=new Acc_Ledger($this->db,$this->operation->jrn_def_id);
|
||||
// Find the max line of the ledger
|
||||
$max_row=$ledger->GetDefLine();
|
||||
$max_row=$ledger->get_min_row();
|
||||
|
||||
// compute nb_item
|
||||
$array['nb_item']=($max_row > $count)?$max_row:$count;
|
||||
|
|
|
|||
|
|
@ -114,7 +114,6 @@ for ($i = 0; $i < $nb_array; $i++) {
|
|||
$a_tot[$colname]=0;
|
||||
}
|
||||
$pdf->line_new();
|
||||
$pdf->SetFont('DejaVuCond', 'B', 7);
|
||||
|
||||
// Display ledger name
|
||||
$ledger_name = $array[$i]['jrn_def_name'];
|
||||
|
|
@ -123,6 +122,7 @@ for ($i = 0; $i < $nb_array; $i++) {
|
|||
$pdf->line_new();
|
||||
|
||||
// Display Header
|
||||
$pdf->SetFont('DejaVuCond', 'B', 7);
|
||||
for ($e=0;$e<$nb_col;$e++){
|
||||
if ( $e == 0 ) {
|
||||
$pdf->write_cell(40, 5,$a_sale_header[$e], 1, 0, 'L');
|
||||
|
|
@ -131,6 +131,8 @@ for ($i = 0; $i < $nb_array; $i++) {
|
|||
}
|
||||
$a_tot[$colname]=0;
|
||||
}
|
||||
$pdf->line_new();
|
||||
$pdf->SetFont('DejaVuCond', '', 7);
|
||||
}
|
||||
for ($e=0;$e<$nb_col;$e++){
|
||||
$colname=$a_col[$e];
|
||||
|
|
@ -220,7 +222,7 @@ $nb_col=count($a_colp);
|
|||
for ($e=2;$e<$nb_col;$e++){
|
||||
$a_tot[$a_colp[$e]]=0;
|
||||
}
|
||||
|
||||
$nb_array=count($array);
|
||||
for ($i = 0; $i < $nb_array; $i++) {
|
||||
for ($e=2;$e<$nb_col;$e++){
|
||||
$colname=$a_colp[$e];
|
||||
|
|
@ -257,19 +259,20 @@ for ($i = 0; $i < $nb_array; $i++) {
|
|||
$pdf->write_cell(70, 5, "");
|
||||
for ($e=2;$e<$nb_col;$e++){
|
||||
$t_idx=$a_colp[$e];
|
||||
$colname=$a_col[$e];
|
||||
$colname=$a_colp[$e];
|
||||
$pdf->write_cell($a_size[$t_idx], 5, nbm($a_tot[$colname]), 0, 0, 'R');
|
||||
$a_tot[$colname]=0;
|
||||
}
|
||||
$pdf->line_new();
|
||||
$pdf->SetFont('DejaVuCond', 'B', 7);
|
||||
|
||||
|
||||
// Display ledger name
|
||||
$ledger_name = $array[$i]['jrn_def_name'];
|
||||
$pdf->SetFont('DejaVuCond', 'B', 10);
|
||||
$pdf->write_cell(50, 8, $ledger_name);
|
||||
$pdf->line_new();
|
||||
|
||||
$pdf->SetFont('DejaVuCond', 'B', 7);
|
||||
|
||||
// Display Header
|
||||
for ($e=0;$e<$nb_col;$e++){
|
||||
$t_idx=$a_colp[$e];
|
||||
|
|
@ -281,6 +284,7 @@ for ($i = 0; $i < $nb_array; $i++) {
|
|||
$a_tot[$colname]=0;
|
||||
}
|
||||
}
|
||||
$pdf->SetFont('DejaVuCond', '', 7);
|
||||
for ($e=0;$e<$nb_col;$e++){
|
||||
$colname=$a_colp[$e];
|
||||
|
||||
|
|
|
|||
|
|
@ -253,7 +253,7 @@ class PDF_Core extends TFPDF
|
|||
parent::Ln($this->bigger);
|
||||
$this->bigger=0;
|
||||
}
|
||||
/**
|
||||
/**
|
||||
* If the step is even then return 1 and set the backgroup color to blue , otherwise
|
||||
* returns 0, and set the background color to white
|
||||
* It is use to compute alternated colored row , it the parameter fill in write_cell and
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ require_once '../include/constant.php';
|
|||
|
||||
define ("ALLOWED",1);
|
||||
|
||||
define ("DOSSIER",26);
|
||||
|
||||
ini_set("xdebug.overload_var_dump",0);
|
||||
|
||||
/**
|
||||
* Class to include,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
DOSSIER_TEST=dossier48
|
||||
DOSSIER_TEST=rel70dossier25
|
||||
|
||||
pg_restore -Fc --no-owner --no-privilege --verbose -d $DOSSIER_TEST db/dossiertest.bin
|
||||
createdb $DOSSIER_TEST
|
||||
pg_restore -Fc --no-owner --no-privilege --verbose -d $DOSSIER_TEST db/dossiertest191101-2109.bin
|
||||
|
||||
|
|
|
|||
3
unit-test/document/fr_be/bnb.form
Normal file
3
unit-test/document/fr_be/bnb.form
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
$C70=round([70%],2)
|
||||
$C60=round([60%],2)
|
||||
|
||||
0
unit-test/document/fr_be/bnb.rtf
Normal file
0
unit-test/document/fr_be/bnb.rtf
Normal file
69
unit-test/facility.class.php
Normal file
69
unit-test/facility.class.php
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
|
||||
namespace Noalyss;
|
||||
|
||||
/*
|
||||
* 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 <danydb@noalyss.eu>
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Set of function to use with phpunit , to save files and to visualize them later, to use tracefile...
|
||||
*/
|
||||
class Facility
|
||||
{
|
||||
|
||||
/**
|
||||
* include code for HTML to generate the display
|
||||
*/
|
||||
static function page_start()
|
||||
{
|
||||
$noalyss_home=NOALYSS_HOME;
|
||||
$ret=<<<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;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a file with the content
|
||||
* @param string $p_dir usually __DIR__
|
||||
* @param string $p_file name of the file
|
||||
* @param string $p_content content
|
||||
*/
|
||||
static function save_file($p_dir, $p_file, $p_content)
|
||||
{
|
||||
$hFile=fopen($p_dir."/".$p_file, "w+");
|
||||
fwrite($hFile, $p_content);
|
||||
fclose($hFile);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -24,10 +24,14 @@
|
|||
* Global variables
|
||||
*/
|
||||
global $g_connection,$g_parameter,$g_user;
|
||||
if (!defined("DOSSIER"))define ("DOSSIER",25);
|
||||
|
||||
$_REQUEST['gDossier'] = DOSSIER;
|
||||
$g_connection=new Database(DOSSIER);
|
||||
$g_parameter = new Noalyss_Parameter_Folder($g_connection);
|
||||
$_SESSION['g_user']='phpcompta';
|
||||
$_SESSION['g_pass']='dany';
|
||||
$_SESSION['g_user']='admin';
|
||||
$_SESSION['g_pass']='phpcompta';
|
||||
$_SESSION['g_pagesize']='50';
|
||||
$g_user=new User($g_connection);
|
||||
|
||||
require_once __DIR__.'/facility.class.php';
|
||||
|
|
@ -42,7 +42,8 @@ class Acc_Account_LedgerTest extends TestCase
|
|||
*/
|
||||
public function testGet_row()
|
||||
{
|
||||
$this->object->get_row(215,235);
|
||||
$array=$this->object->get_row(92,103);
|
||||
$this->assertEquals(count($array),3);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -256,8 +257,8 @@ class Acc_Account_LedgerTest extends TestCase
|
|||
function dataFind_Card()
|
||||
{
|
||||
return array(
|
||||
array('6191', '22'),
|
||||
array('6192', '23'),
|
||||
array('6191', '27'),
|
||||
array('6192', '28'),
|
||||
array('4400004', '25')
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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(8,count($array));
|
||||
$this->assertEquals(10,count($array));
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -63,8 +63,10 @@ class Acc_BalanceTest extends TestCase
|
|||
$this->object->jrn=1;
|
||||
$this->object->filter_cat(array());
|
||||
$this->assertEquals($this->object->jrn,null);
|
||||
$this->object->filter_cat(array('FIN'));
|
||||
$this->assertEquals($this->object->jrn[0],2);
|
||||
$this->object->filter_cat(array('2'=>'FIN'));
|
||||
$this->assertEquals($this->object->jrn,[1]);
|
||||
$this->object->filter_cat(array('1'=>'ACH','2'=>'FIN'));
|
||||
$this->assertEquals($this->object->jrn,[3,35,1]);
|
||||
}
|
||||
/**
|
||||
*@covers Acc_Balance::summary_add
|
||||
|
|
@ -102,15 +104,7 @@ class Acc_BalanceTest extends TestCase
|
|||
|
||||
|
||||
}
|
||||
/**
|
||||
*@covers Acc_Balance::summary_add
|
||||
*/
|
||||
public function testSummary_display_pdf()
|
||||
{
|
||||
// No test since a PDF is modified and cannot be tested
|
||||
// by PHPUNIT
|
||||
$this->markTestSkipped("Summary_display_pdf cannot be tested since it modify a PDF");
|
||||
}
|
||||
|
||||
/**
|
||||
*@covers Acc_Balance::summary_init
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -55,12 +55,12 @@ class Acc_BilanTest extends TestCase
|
|||
*/
|
||||
public function testVerify()
|
||||
{
|
||||
ob_start();
|
||||
$this->object->verify();
|
||||
$r=ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
$this->assertStringStartsWith('<h3>',$r);
|
||||
ob_start();
|
||||
$this->object->verify();
|
||||
$r=ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
$this->assertStringStartsWith('<h3>',$r);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -69,10 +69,13 @@ class Acc_BilanTest extends TestCase
|
|||
*/
|
||||
public function testGet_request_get()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$_GET['b_id']=111;
|
||||
$_GET['from_periode']=95;
|
||||
$_GET['to_periode']=100;
|
||||
$this->object->get_request_get();
|
||||
$this->assertEquals($this->object->b_id,111);
|
||||
$this->assertEquals($this->object->from,95);
|
||||
$this->assertEquals($this->object->to,100);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -81,46 +84,65 @@ class Acc_BilanTest extends TestCase
|
|||
*/
|
||||
public function testLoad()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
|
||||
$this->object->b_id=1;
|
||||
$this->object->load();
|
||||
$this->assertEquals($this->object->b_type,'rtf');
|
||||
$this->assertEquals($this->object->b_file_form,'document/fr_be/bnb.form');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Bilan::file_open_form
|
||||
* @todo Implement testFile_open_form().
|
||||
*
|
||||
*/
|
||||
public function testFile_open_form()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->object->b_id=1;
|
||||
$this->object->load();
|
||||
try {
|
||||
$file=$this->object->file_open_form();
|
||||
$this->assertTrue(TRUE);
|
||||
} catch(Exception $e) {
|
||||
echo $e->getTraceAsString();
|
||||
$this->assertTrue(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Bilan::file_open_template
|
||||
* @todo Implement testFile_open_template().
|
||||
*
|
||||
*/
|
||||
public function testFile_open_template()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->object->b_id=1;
|
||||
$this->object->load();
|
||||
try {
|
||||
$file=$this->object->file_open_template();
|
||||
$this->assertTrue(TRUE);
|
||||
} catch(Exception $e) {
|
||||
echo $e->getTraceAsString();
|
||||
$this->assertTrue(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Bilan::compute_formula
|
||||
* @todo Implement testCompute_formula().
|
||||
*/
|
||||
public function testCompute_formula()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->object->b_id=1;
|
||||
$hFile=fopen("document/fr_be/bnb.form",'r');
|
||||
|
||||
$this->object->from=92;
|
||||
$this->object->to=103;
|
||||
|
||||
$this->object->compute_formula($hFile);
|
||||
|
||||
$this->assertTrue(isset($this->object->C70));
|
||||
$this->assertTrue(isset($this->object->C60));
|
||||
$this->assertEquals($this->object->C70,445.6);
|
||||
$this->assertEquals($this->object->C60,0);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -171,16 +193,6 @@ class Acc_BilanTest extends TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Bilan::test_me
|
||||
* @todo Implement testTest_me().
|
||||
*/
|
||||
public function testTest_me()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,8 +71,7 @@ class Acc_LedgerTest extends TestCase
|
|||
|
||||
$this->object->id=2;
|
||||
$sPj=$this->object->get_last_pj(2);
|
||||
print_r("get_last_pj $sPj");
|
||||
$this->assertEquals(5,$sPj);
|
||||
$this->assertEquals(9,$sPj);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -99,22 +98,13 @@ class Acc_LedgerTest extends TestCase
|
|||
$this->assertEquals('ACH',$type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::delete
|
||||
* @todo Implement testDelete().
|
||||
*/
|
||||
public function testDelete()
|
||||
{
|
||||
global $g_connection;
|
||||
$jr_id=$g_connection->get_value("select max(jr_id) from jrn");
|
||||
$this->object->jr_id=$jr_id;
|
||||
$this->object->delete();
|
||||
$count=$g_connection->get_value("select count(*) from jrn where jr_id=$1",[$jr_id]);
|
||||
$this->assertEquals($count,0);
|
||||
}
|
||||
|
||||
public function delete_ledger()
|
||||
{
|
||||
global $g_connection;
|
||||
// 0. clean
|
||||
$g_connection->exec_sql("delete from jrn_def where jrn_def_name=$1",["UNITTEST"]);
|
||||
|
||||
// a . create a ledger and delete it
|
||||
$array=["p_jrn_def_name"=>"UNITTEST","p_ech_lib"=>"","p_jrn_deb_max_line"=>7,'p_jrn_type'=>'ODS','jrn_def_pj_pref'=>'TT/','min_row'=>5,'p_description'=>'LEDGER UNIT TEST','jrn_def_negative_amount'=>0,'jrn_def_negative_warning'=>'Warning'];
|
||||
$this->object->save_new($array);
|
||||
|
|
@ -141,6 +131,10 @@ class Acc_LedgerTest extends TestCase
|
|||
$this->assertEquals($ok,1);
|
||||
$cnt=$g_connection->get_value("select count(*) from jrn_def where jrn_def_id=$1",[$ledger_id]);
|
||||
$this->assertEquals($cnt,1);
|
||||
|
||||
// 0. clean
|
||||
$g_connection->exec_sql("delete from jrn_def where jrn_def_name=$1",["UNITTEST"]);
|
||||
|
||||
}
|
||||
/**
|
||||
* @covers Acc_Ledger::display_warning
|
||||
|
|
@ -164,10 +158,8 @@ class Acc_LedgerTest extends TestCase
|
|||
$this->assertFalse(empty($this->object->jr_id),"not found jr_id ");
|
||||
|
||||
$this->object->id=$g_connection->get_value("select jr_def_id from jrn where jr_id=$1",[$this->object->jr_id]);
|
||||
$this->assertGreaterThan($this->object->id,"0","found id ".$this->object->id);
|
||||
$this->assertLessThan($this->object->id,"0","found id ".$this->object->id);
|
||||
$this->assertFalse(empty($this->object->id),"not found id ");
|
||||
print_r("jr_id = ".$this->object->jr_id);
|
||||
print_r("id = ".$this->object->id);
|
||||
$date=$g_connection->get_value ("select to_char(max(p_start),'DD.MM.YYYY') from parm_periode where p_closed='f'");
|
||||
$this->object->reverse($date,'unit test'.$date);
|
||||
$check=$g_connection->get_value("select jr_id from jrn where jr_comment=$1",["unit test".$date]);
|
||||
|
|
@ -213,7 +205,7 @@ class Acc_LedgerTest extends TestCase
|
|||
{
|
||||
$this->object->id=2;
|
||||
$r=$this->object->guess_pj();
|
||||
$this->assertEquals("VEN6",$r);
|
||||
$this->assertEquals("VEN10",$r);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -229,17 +221,6 @@ class Acc_LedgerTest extends TestCase
|
|||
$this->assertEquals(count($array),20);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::GetDefLine
|
||||
* @todo Implement testGetDefLine().
|
||||
*/
|
||||
public function testGetDefLine()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @covers Acc_Ledger::display_negative_warning
|
||||
*/
|
||||
|
|
@ -278,10 +259,14 @@ class Acc_LedgerTest extends TestCase
|
|||
*/
|
||||
public function testGet_solde()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
global $g_connection;
|
||||
$ledger=new Acc_Ledger($g_connection,2);
|
||||
$max=$g_connection->get_value("select max(p_id) from parm_periode");
|
||||
$min=$g_connection->get_value("select min(p_id) from parm_periode");
|
||||
$solde=$ledger->get_solde($min,$max);
|
||||
$this->assertEquals($solde[0],490.77);
|
||||
$this->assertEquals($solde[1],490.77);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -290,22 +275,20 @@ class Acc_LedgerTest extends TestCase
|
|||
*/
|
||||
public function testSelect_ledger()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$select_available=$this->object->select_ledger();
|
||||
$this->assertEquals(4,count($select_available->value));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::get_fiche_def
|
||||
* @todo Implement testGet_fiche_def().
|
||||
*/
|
||||
public function testGet_fiche_def()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
global $g_connection;
|
||||
$ledger=new Acc_Ledger($g_connection,0);
|
||||
$this->assertEmpty($ledger->get_fiche_def());
|
||||
$ledger=new Acc_Ledger($g_connection,2);
|
||||
$this->assertEquals(2,count($ledger->get_fiche_def()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -314,10 +297,11 @@ class Acc_LedgerTest extends TestCase
|
|||
*/
|
||||
public function testGet_class_def()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
global $g_connection;
|
||||
$ledger=new Acc_Ledger($g_connection,0);
|
||||
$this->assertEmpty($ledger->get_class_def());
|
||||
$ledger=new Acc_Ledger($g_connection,2);
|
||||
$this->assertEquals(1,count($ledger->get_class_def()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -326,10 +310,50 @@ class Acc_LedgerTest extends TestCase
|
|||
*/
|
||||
public function testConfirm()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$array=[
|
||||
array("ac"=>"COMPTA/MENUODS/ODS"),
|
||||
"pa_id"=>array(2),
|
||||
"e_date"=>"17.11.2018",
|
||||
"desc"=>"",
|
||||
"period"=>102,
|
||||
"e_pj"=>"ODS1",
|
||||
"e_pj_suggest"=>"ODS1",
|
||||
"mt"=>1572640802.992,
|
||||
"e_comm"=>"",
|
||||
"jrn_type"=>"ODS",
|
||||
"p_jrn"=>4,
|
||||
"nb_item"=>3,
|
||||
"jrn_concerned"=>"",
|
||||
"gDossier"=>25,
|
||||
"qc_0"=>"",
|
||||
"poste0"=>601,
|
||||
"ld0"=>"Achats de fournitures",
|
||||
"ck0"=>"",
|
||||
"amount0"=>100,
|
||||
"op"=>array(0),
|
||||
"amount_t0"=>100,
|
||||
"hplan"=>array(array(-1)),
|
||||
"val"=>array(array(100)),
|
||||
"poste1"=>"4511",
|
||||
"ld1"=>"TVA à payer 21%",
|
||||
"ck1"=>"",
|
||||
"qc_1"=>"",
|
||||
"amount1"=>21,
|
||||
"qc_2"=>"FOURNI2",
|
||||
"ld2"=>"fournisseur 3",
|
||||
"amount2"=>121,
|
||||
"opd_name"=>"",
|
||||
"od_description"=>"",
|
||||
"reverse_date"=>"",
|
||||
"ext_label"=>"",
|
||||
"jr_optype"=>"NOR",
|
||||
"save"=>"Confirmer"
|
||||
];
|
||||
$this->object->set_ledger_id(4);
|
||||
$this->object->with_concerned=FALSE;
|
||||
$ret=$this->object->confirm($array);
|
||||
$this->assertContains('td class="num">121,00<INPUT TYPE="hidden" id="amount2" NAME="amount2" VALUE="121"></td></tr><tr class="highlight"><td ></td><td >Totaux</td><td class="num">121.00</td><td class="num">121.00</td></tr></table><input type="button" class="button" value="verifie Imputation Analytique" onClick="verify_ca(\'\');">',$ret);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -338,10 +362,15 @@ class Acc_LedgerTest extends TestCase
|
|||
*/
|
||||
public function testGet_min_row()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
global $g_connection;
|
||||
$a_ledger=$g_connection->get_array("select jrn_def_id,jrn_deb_max_line from jrn_def");
|
||||
$nb_ledger=(empty($a_ledger))?0:count($a_ledger);
|
||||
$this->assertGreaterThan (0,$nb_ledger);
|
||||
for ($i=0;$i<$nb_ledger;$i++) {
|
||||
$ledger=new Acc_Ledger($g_connection,$a_ledger[$i]['jrn_def_id']);
|
||||
$cnt=$ledger->get_min_row();
|
||||
$this->assertEquals($a_ledger[$i]['jrn_deb_max_line'],$cnt);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -350,10 +379,29 @@ class Acc_LedgerTest extends TestCase
|
|||
*/
|
||||
public function testInput()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
|
||||
try {
|
||||
global $g_connection;
|
||||
$ledger=new Acc_Ledger($g_connection,4);
|
||||
put_global([["key"=>"ac","value"=>"ODS"]]);
|
||||
$str=$ledger->input(null,0);
|
||||
//---------------------------------------------------------------------------
|
||||
// Save it first , and test after
|
||||
// $file=fopen(__DIR__."/file/acc_ledgerTest.testInput.txt","w+");
|
||||
// fwrite($file, $str);
|
||||
// fclose($file);
|
||||
//---------------------------------------------------------------------------
|
||||
$str_fileresult=tempnam("/tmp","acc_ledger_input.txt");
|
||||
$fileresult=fopen($str_fileresult,"w+");
|
||||
fwrite($fileresult,$str);
|
||||
// fclose($fileresult);
|
||||
|
||||
$this->assertContains(' onChange="format_number(this);checkTotalDirect()" ',
|
||||
$str);
|
||||
} catch (Exception $ex) {
|
||||
$this->assertTrue(False);
|
||||
throw $ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -362,22 +410,43 @@ class Acc_LedgerTest extends TestCase
|
|||
*/
|
||||
public function testIs_closed()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
global $g_connection;
|
||||
$ledger=new Acc_Ledger($g_connection,4);
|
||||
$this->assertEquals(1,$ledger->is_closed(99));
|
||||
$this->assertEquals(0,$ledger->is_closed(101));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::verify
|
||||
* @todo Implement testVerify().
|
||||
*/
|
||||
public function testVerify()
|
||||
public function testVerify_Ledger()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
global $g_connection;
|
||||
$ledger=new Acc_Ledger($g_connection,4);
|
||||
$array=[
|
||||
"p_jrn"=>"15",
|
||||
"p_jrn_deb_max_line"=>5,
|
||||
"p_jrn_name"=>"New ledger",
|
||||
"p_jrn_type"=>"ODS"
|
||||
];
|
||||
// Must success
|
||||
try {
|
||||
$ledger->verify_ledger($array);
|
||||
$this->assertTrue(TRUE);
|
||||
} catch (Exception $ex) {
|
||||
var_dump($ex->getMessage());
|
||||
var_dump($ex->getTraceAsString());
|
||||
}
|
||||
|
||||
// Must fail
|
||||
$a_ledger["p_jrn"]="a";
|
||||
try {
|
||||
$ledger->verify_ledger($array);
|
||||
$this->assertTrue(FALSE);
|
||||
} catch (Exception $ex) {
|
||||
$this->assertTrue(TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -386,34 +455,60 @@ class Acc_LedgerTest extends TestCase
|
|||
*/
|
||||
public function testCompute_internal_code()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->object->set_ledger_id(4);
|
||||
$str=$this->object->compute_internal_code(10);
|
||||
$this->assertFalse(empty($str));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::save
|
||||
* @todo Implement testSave().
|
||||
* @covers Acc_Ledger::save Acc_Ledger::delete
|
||||
*/
|
||||
public function testSave()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::get_request
|
||||
* @todo Implement testGet_request().
|
||||
*/
|
||||
public function testGet_request()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$array=[
|
||||
"pa_id"=>array(2),
|
||||
"e_date"=>"01.09.2018",
|
||||
"desc"=>"test",
|
||||
"period"=>100,
|
||||
"e_pj"=>"ODS1",
|
||||
"e_pj_suggest"=>"ODS1",
|
||||
"mt"=>1572642748.22,
|
||||
"e_comm"=>"test",
|
||||
"jrn_type"=>"ODS",
|
||||
"p_jrn"=>4,
|
||||
"nb_item"=>5,
|
||||
"jrn_concerned"=>"",
|
||||
"gDossier"=>25,
|
||||
"poste0"=>601,
|
||||
"ld0"=>"Achats de fournitures",
|
||||
"ck0"=>"",
|
||||
"amount0"=>100,
|
||||
"op"=>Array(0),
|
||||
"amount_t0"=>100,
|
||||
"hplan"=>array( array(-1)),
|
||||
"val"=>array(array("0"=>array("0"=>100))),
|
||||
"poste1"=>"4511",
|
||||
"ld1"=>"TVA à payer 21%",
|
||||
"amount1"=>100,
|
||||
"opd_name"=>"",
|
||||
"od_description"=>"",
|
||||
"reverse_date"=>"",
|
||||
"ext_label"=>"",
|
||||
"jr_optype"=>"NOR"
|
||||
];
|
||||
global $g_connection;
|
||||
$ledger=new Acc_Ledger($g_connection,4);
|
||||
$g_connection->exec_sql("delete from jrn where jr_mt=$1",[$array["mt"]]);
|
||||
$cnt=$g_connection->get_value("select count(*) from jrn where jr_mt=$1",[$array['mt']]);
|
||||
$this->assertEquals(0,$cnt);
|
||||
$ledger->save($array);
|
||||
$cnt=$g_connection->get_value("select count(*) from jrn where jr_mt=$1",[$array['mt']]);
|
||||
$this->assertEquals(1,$cnt);
|
||||
|
||||
$ledger->delete();
|
||||
$cnt=$g_connection->get_value("select count(*) from jrn where jr_mt=$1",[$array['mt']]);
|
||||
$this->assertEquals(0,$cnt);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -422,10 +517,9 @@ class Acc_LedgerTest extends TestCase
|
|||
*/
|
||||
public function testNext_number()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
global $g_connection;
|
||||
$this->assertEquals(2,Acc_Ledger::next_number($g_connection, "ODS"));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -434,46 +528,10 @@ class Acc_LedgerTest extends TestCase
|
|||
*/
|
||||
public function testGet_first()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::update_paid
|
||||
* @todo Implement testUpdate_paid().
|
||||
*/
|
||||
public function testUpdate_paid()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::update_internal_code
|
||||
* @todo Implement testUpdate_internal_code().
|
||||
*/
|
||||
public function testUpdate_internal_code()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::get_default_card
|
||||
* @todo Implement testGet_default_card().
|
||||
*/
|
||||
public function testGet_default_card()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
global $g_connection;
|
||||
$ledger=new Acc_Ledger($g_connection,4);
|
||||
$first_ledger=$ledger->get_first("ODS");
|
||||
$this->assertEquals(4,$first_ledger["jrn_def_id"]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -482,10 +540,9 @@ class Acc_LedgerTest extends TestCase
|
|||
*/
|
||||
public function testGet_all_fiche_def()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
global $g_connection;
|
||||
$ledger=new Acc_Ledger($g_connection,4);
|
||||
$this->assertEquals("3,2,4",$ledger->get_all_fiche_def());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -494,34 +551,31 @@ class Acc_LedgerTest extends TestCase
|
|||
*/
|
||||
public function testGet_saldo_exercice()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::check_strict
|
||||
* @todo Implement testCheck_strict().
|
||||
*/
|
||||
public function testCheck_strict()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::check_periode
|
||||
* @todo Implement testCheck_periode().
|
||||
*/
|
||||
public function testCheck_periode()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$result=[
|
||||
["solde"=> 658.2500 , "j_poste"=> "4400004", "j_qcode"=> "FOURNI"],
|
||||
["solde"=> 490.7700 , "j_poste"=> "4000005", "j_qcode"=> "CLIENT1"],
|
||||
["solde"=> 21.9600, "j_poste"=> "4112", "j_qcode"=> ""],
|
||||
["solde"=>-85.1700 , "j_poste"=> "4511", "j_qcode"=> ""],
|
||||
["solde"=> -863.2100 , "j_poste"=>"4400005", "j_qcode"=> "FOURNI1"]
|
||||
];
|
||||
$get=$this->object->get_saldo_exercice("2018");
|
||||
$nb_get=count($get);
|
||||
$nb_result=count($result);
|
||||
$ix=0;
|
||||
for ($i=0;$i<$nb_get;$i++)
|
||||
{
|
||||
for ($e=0;$e<$nb_result;$e++) {
|
||||
if (
|
||||
$result[$e]["j_poste"] == $get[$i]["j_poste"] &&
|
||||
$result[$e]["j_qcode"] == $get[$i]["j_qcode"]
|
||||
)
|
||||
{
|
||||
$this->assertEquals($result[$e]["solde"],$get[$i]["solde"]);
|
||||
$ix++;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->assertEquals(5,$ix);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -530,10 +584,9 @@ class Acc_LedgerTest extends TestCase
|
|||
*/
|
||||
public function testGet_last_date()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->object->set_ledger_id(2);
|
||||
$last_date=$this->object->get_last_date();
|
||||
$this->assertEquals("24.04.2018",$last_date);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -542,179 +595,11 @@ class Acc_LedgerTest extends TestCase
|
|||
*/
|
||||
public function testGet_id()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->assertEquals(3,$this->object->get_id("V000003"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::create_document
|
||||
* @todo Implement testCreate_document().
|
||||
*/
|
||||
public function testCreate_document()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::check_payment
|
||||
* @todo Implement testCheck_payment().
|
||||
*/
|
||||
public function testCheck_payment()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::inc_seq_pj
|
||||
* @todo Implement testInc_seq_pj().
|
||||
*/
|
||||
public function testInc_seq_pj()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::search_form
|
||||
* @todo Implement testSearch_form().
|
||||
*/
|
||||
public function testSearch_form()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::build_search_sql
|
||||
* @todo Implement testBuild_search_sql().
|
||||
*/
|
||||
public function testBuild_search_sql()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::display_search_form
|
||||
* @todo Implement testDisplay_search_form().
|
||||
*/
|
||||
public function testDisplay_search_form()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::get_last
|
||||
* @todo Implement testGet_last().
|
||||
*/
|
||||
public function testGet_last()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::search_group
|
||||
* @todo Implement testSearch_group().
|
||||
*/
|
||||
public function testSearch_group()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::get_operation
|
||||
* @todo Implement testGet_operation().
|
||||
*/
|
||||
public function testGet_operation()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::existing_vat
|
||||
* @todo Implement testExisting_vat().
|
||||
*/
|
||||
public function testExisting_vat()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::get_other_amount
|
||||
* @todo Implement testGet_other_amount().
|
||||
*/
|
||||
public function testGet_other_amount()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::vat_operation
|
||||
* @todo Implement testVat_operation().
|
||||
*/
|
||||
public function testVat_operation()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::previous_amount
|
||||
* @todo Implement testPrevious_amount().
|
||||
*/
|
||||
public function testPrevious_amount()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::test_me
|
||||
* @todo Implement testTest_me().
|
||||
*/
|
||||
public function testTest_me()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::array_cat
|
||||
|
|
@ -762,53 +647,97 @@ class Acc_LedgerTest extends TestCase
|
|||
$this->assertGreaterThan(0,$this->object->get_tiers_id("VEN",$jr_id));
|
||||
|
||||
}
|
||||
/**
|
||||
* @covers Acc_Ledger::listing
|
||||
* @todo Implement testListing().
|
||||
*/
|
||||
public function testListing()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::display_ledger
|
||||
* @todo Implement testDisplay_ledger().
|
||||
*/
|
||||
public function testDisplay_ledger()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::verify_ledger
|
||||
* @todo Implement testVerify_ledger().
|
||||
*/
|
||||
public function testVerify_ledger()
|
||||
public function testVerify_Operation()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
global $g_connection;
|
||||
$array = [ "p_jrn" => 4,
|
||||
"p_jrn_predef" => 4,
|
||||
"action" => "use_opd",
|
||||
"jrn_type" => "ODS",
|
||||
"e_date" => "17.11.2018",
|
||||
"e_pj" => "ODS1",
|
||||
"e_pj_suggest" => "ODS1",
|
||||
"desc" => "",
|
||||
"nb_item" => 5,
|
||||
"qc_0" => "",
|
||||
"poste0" => "601",
|
||||
"ld0" => "Achats de fournitures",
|
||||
"amount0" => 100,
|
||||
"ck0" => "",
|
||||
"qc_1" => "",
|
||||
"poste1" => "4511",
|
||||
"ld1" => "TVA à payer 21%",
|
||||
"amount1" => 21,
|
||||
"ck1" => "",
|
||||
"qc_2" => "FOURNI2",
|
||||
"poste2" => "",
|
||||
"ld2" => "fournisseur 3",
|
||||
"amount2" => 121,
|
||||
"qc_3" => "",
|
||||
"poste3" => "",
|
||||
"ld3" => "",
|
||||
"amount3" => "",
|
||||
"qc_4" => "",
|
||||
"poste4" => "",
|
||||
"ld4" => "",
|
||||
"amount4" =>"",
|
||||
"jrn_concerned" => "",
|
||||
"summary" => "Sauvez"
|
||||
];
|
||||
$ledger=new Acc_Ledger($g_connection,4);
|
||||
|
||||
// This test must succeed
|
||||
try {
|
||||
$ledger->verify_operation($array);
|
||||
$this->assertTrue(TRUE);
|
||||
} catch(Exception $e)
|
||||
{
|
||||
var_dump($e->getMessage());
|
||||
var_dump($e->getTraceAsString());
|
||||
$this->assertTrue(FALSE);
|
||||
throw $e;
|
||||
}
|
||||
|
||||
// wrong date must fail
|
||||
|
||||
$wrong_array=$array;
|
||||
$wrong_array["e_date"]="aaa";
|
||||
try {
|
||||
$ledger->verify_operation($wrong_array);
|
||||
$this->assertTrue(FALSE);
|
||||
} catch(Exception $e)
|
||||
{
|
||||
$this->assertEquals(2,$e->getCode());
|
||||
}
|
||||
|
||||
// periode closed must fail
|
||||
$wrong_array=$array;
|
||||
$wrong_array["e_date"]="01.01.2110";
|
||||
try {
|
||||
$ledger->verify_operation($wrong_array);
|
||||
$this->assertTrue(FALSE);
|
||||
} catch(Exception $e)
|
||||
{
|
||||
$this->assertEquals(2,$e->getCode());
|
||||
}
|
||||
// periode closed must fail
|
||||
$wrong_array=$array;
|
||||
$wrong_array["e_date"]="01.07.2018";
|
||||
try {
|
||||
$ledger->verify_operation($wrong_array);
|
||||
$this->assertTrue(FALSE);
|
||||
} catch(Exception $e)
|
||||
{
|
||||
$this->assertEquals(6,$e->getCode());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::update
|
||||
* @todo Implement testUpdate().
|
||||
*/
|
||||
public function testUpdate()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::input_paid
|
||||
|
|
@ -826,10 +755,19 @@ class Acc_LedgerTest extends TestCase
|
|||
*/
|
||||
public function testInput_new()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
put_global([["key"=>"ac","value"=>"ODS"]]);
|
||||
// ob_start();
|
||||
//
|
||||
// $this->object->set_ledger_id(4);
|
||||
// $this->object->input_new();
|
||||
// $result=ob_get_contents();
|
||||
// $file=fopen(__DIR__."/file/acc_ledger_input_new.txt","w+");
|
||||
// fwrite($file,$result);
|
||||
// fclose($file);*/
|
||||
$this->expectOutputRegex('!<tr><TD> <INPUT TYPE="CHECKBOX" VALUE="3" NAME="FIN_FICHEDEB\[\]" CHECKED>Banque<\/TD><\/TR><tr><TD> <INPUT TYPE="CHECKBOX" VALUE="2" NAME="FIN_FICHEDEB\[\]" CHECKED>Client<\/TD><\/TR><tr><TD> <INPUT TYPE="CHECKBOX" VALUE="4" NAME="FIN_FICHEDEB\[\]" CHECKED>Fournisseur<\/TD><\/TR><tr><TD> <INPUT TYPE="CHECKBOX" VALUE="1" NAME="FIN_FICHEDEB\[\]" unchecked>Marchandises<\/TD><\/TR><tr><TD> <INPUT TYPE="CHECKBOX" VALUE="5" NAME="FIN_FICHEDEB\[\]" unchecked>Services & Biens Divers<\/TD><\/TR><tr><TD> <INPUT TYPE="CHECKBOX" VALUE="500000" NAME="FIN_FICHEDEB\[\]" unchecked>Stock<\/TD><\/TR><tr><TD> <INPUT TYPE="CHECKBOX" VALUE="6" NAME="FIN_FICHEDEB\[\]" unchecked>Vente<\/TD><\/TR> <\/TABLE>!
|
||||
');
|
||||
$this->object->set_ledger_id(4);
|
||||
$this->object->input_new();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -850,10 +788,12 @@ class Acc_LedgerTest extends TestCase
|
|||
'negative_amount'=>0,
|
||||
'negative_warning'=>'Warning'];
|
||||
|
||||
|
||||
// clean ledger if exists
|
||||
$g_connection->exec_sql("delete from jrn_def where jrn_def_name=$1",[$array['p_jrn_name']]);
|
||||
|
||||
$this->object->save_new($array);
|
||||
$jrn_def_id=$g_connection->get_value("select jrn_def_id from jrn_def where jrn_def_name=$1",[$array['p_jrn_name']]);
|
||||
$this->assertGreaterThan($jrn_def_id,0);
|
||||
$this->assertLessThan($jrn_def_id,0);
|
||||
$ledger=new Acc_Ledger($g_connection,$jrn_def_id);
|
||||
$ledger->delete_ledger();
|
||||
$jrn_def_id=$g_connection->get_value("select jrn_def_id from jrn_def where jrn_def_name=$1",[$array['p_jrn_name']]);
|
||||
|
|
@ -876,12 +816,14 @@ class Acc_LedgerTest extends TestCase
|
|||
'min_row'=>5,
|
||||
'p_description'=>'LEDGER UNIT TEST',
|
||||
'negative_amount'=>0,
|
||||
'negative_warning'=>'Warning'
|
||||
];
|
||||
|
||||
'negative_warning'=>'Warning'];
|
||||
// clean ledger if exists
|
||||
$g_connection->exec_sql("delete from jrn_def where jrn_def_name=$1",[$array['p_jrn_name']]);
|
||||
|
||||
// Recreate it
|
||||
$this->object->save_new($array);
|
||||
$jrn_def_id=$g_connection->get_value("select jrn_def_id from jrn_def where jrn_def_name=$1",[$array['p_jrn_name']]);
|
||||
$this->assertGreaterThan($jrn_def_id,0);
|
||||
$this->assertLessThan($jrn_def_id,0);
|
||||
$ledger=new Acc_Ledger($g_connection,$jrn_def_id);
|
||||
$ledger->delete_ledger();
|
||||
$jrn_def_id=$g_connection->get_value("select jrn_def_id from jrn_def where jrn_def_name=$1",[$array['p_jrn_name']]);
|
||||
|
|
@ -941,16 +883,4 @@ class Acc_LedgerTest extends TestCase
|
|||
$this->assertTrue(is_array($this->object->get_customer_late()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger::convert_from_follow
|
||||
* @todo Implement testConvert_from_follow().
|
||||
*/
|
||||
public function testConvert_from_follow()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -32,108 +80,103 @@ class Acc_Ledger_FinTest extends TestCase
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger_Fin::verify
|
||||
* @todo Implement testVerify().
|
||||
* @expectedException Exception
|
||||
*/
|
||||
public function testVerify()
|
||||
{
|
||||
|
||||
$this->object->verify(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger_Fin::input
|
||||
* @todo Implement testInput().
|
||||
*/
|
||||
public function testInput()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$result=$this->object->input($this->array);
|
||||
$this->assertContains("show_fin_chdate('chdate');",$result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger_Fin::confirm
|
||||
* @todo Implement testConfirm().
|
||||
*/
|
||||
public function testConfirm()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$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()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
$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()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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);
|
||||
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(9, $this->object->get_bank());
|
||||
$this->assertEquals(30, $this->object->get_bank());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger_Fin::numb_operation
|
||||
* @todo Implement testNumb_operation().
|
||||
*/
|
||||
public function testNumb_operation()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger_Fin::insert_quant_fin
|
||||
* @todo Implement testInsert_quant_fin().
|
||||
*/
|
||||
public function testInsert_quant_fin()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,96 @@
|
|||
<?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 <danydb@noalyss.eu>
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief concerne acc_ledger_history_financialTest.class
|
||||
*/
|
||||
class Acc_Ledger_History_FinancialTest 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_Financial($g_connection, [1], 92, 131, 'E');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
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->assertEquals(5, 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();
|
||||
echo \Noalyss\Facility::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();
|
||||
echo \Noalyss\Facility::page_start();
|
||||
$this->object->export_html();
|
||||
$content=ob_get_contents();
|
||||
|
||||
$this->save_file($name, $content);
|
||||
$this->assertFileExists(__DIR__."/file/".$name);
|
||||
|
||||
}
|
||||
}
|
||||
117
unit-test/include/class/acc_ledger_history_genericTest.class.php
Normal file
117
unit-test/include/class/acc_ledger_history_genericTest.class.php
Normal file
|
|
@ -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 <danydb@noalyss.eu>
|
||||
|
||||
/**
|
||||
* @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();
|
||||
echo \Noalyss\Facility::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();
|
||||
echo \Noalyss\Facility::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();
|
||||
echo \Noalyss\Facility::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();
|
||||
echo \Noalyss\Facility::page_start();
|
||||
$this->object->export_html();
|
||||
$content=ob_get_contents();
|
||||
|
||||
$this->save_file($name, $content);
|
||||
$this->assertFileExists(__DIR__."/file/".$name);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
<?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 <danydb@noalyss.eu>
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief concerne acc_ledger_history_purchaseTest.class
|
||||
*/
|
||||
class Acc_Ledger_History_PurchaseTest 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_Purchase($g_connection, [3], 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()
|
||||
{
|
||||
|
||||
}
|
||||
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()),65);
|
||||
|
||||
}
|
||||
//@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();
|
||||
echo \Noalyss\Facility::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();
|
||||
echo \Noalyss\Facility::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();
|
||||
echo \Noalyss\Facility::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();
|
||||
echo \Noalyss\Facility::page_start();
|
||||
$this->object->export_html();
|
||||
$content=ob_get_contents();
|
||||
|
||||
$this->save_file($name, $content);
|
||||
$this->assertFileExists(__DIR__."/file/".$name);
|
||||
}
|
||||
|
||||
}
|
||||
113
unit-test/include/class/acc_ledger_history_saleTest.class.php
Normal file
113
unit-test/include/class/acc_ledger_history_saleTest.class.php
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
<?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 <danydb@noalyss.eu>
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief concerne Acc_Ledger_History_SaleTest.class
|
||||
*/
|
||||
class Acc_Ledger_History_SaleTest 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_Sale($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()),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();
|
||||
echo \Noalyss\Facility::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();
|
||||
echo \Noalyss\Facility::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();
|
||||
echo \Noalyss\Facility::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();
|
||||
echo \Noalyss\Facility::page_start();
|
||||
$this->object->export_html();
|
||||
$content=ob_get_contents();
|
||||
|
||||
$this->save_file($name, $content);
|
||||
$this->assertFileExists(__DIR__."/file/".$name);
|
||||
}
|
||||
}
|
||||
85
unit-test/include/class/acc_ledger_infoTest.class.php
Normal file
85
unit-test/include/class/acc_ledger_infoTest.class.php
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
<?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 <danydb@noalyss.eu>
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief concerne acc_ledger_infoTest.class
|
||||
*/
|
||||
class Acc_Ledger_InfoTest 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_Info($g_connection);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
}
|
||||
function test_insertBonCommande()
|
||||
{
|
||||
global $g_connection;
|
||||
$this->object->jr_id=3;
|
||||
$this->object->id_type='BON_COMMANDE';
|
||||
$this->object->ji_value='BON';
|
||||
|
||||
$cnt=$g_connection->get_array("select * from jrn_info where jr_id=$1",[$this->object->jr_id]);
|
||||
$this->assertSame(count($cnt),0);
|
||||
$this->object->insert();
|
||||
$cnt=$g_connection->get_array("select * from jrn_info where jr_id=$1",[$this->object->jr_id]);
|
||||
$this->assertSame(count($cnt),1);
|
||||
$g_connection->exec_sql("delete from jrn_info where jr_id=$1",[$this->object->jr_id]);
|
||||
|
||||
}
|
||||
function test_insertOther()
|
||||
{
|
||||
global $g_connection;
|
||||
$this->object->set_jrn_id(7);
|
||||
$this->object->set_type('OTHER');
|
||||
$this->object->set_value('Autre test');
|
||||
|
||||
$cnt=$g_connection->get_array("select * from jrn_info where jr_id=$1",[$this->object->jr_id]);
|
||||
$this->assertSame(count($cnt),0);
|
||||
$this->object->insert();
|
||||
$cnt=$g_connection->get_array("select * from jrn_info where jr_id=$1",[$this->object->jr_id]);
|
||||
$this->assertSame(count($cnt),1);
|
||||
$g_connection->exec_sql("delete from jrn_info where jr_id=$1",[$this->object->jr_id]);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
|
|
@ -13,6 +14,11 @@ class Acc_Ledger_PurchaseTest extends TestCase
|
|||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* @var array transmitted by _POST
|
||||
*/
|
||||
private $array;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
|
|
@ -20,7 +26,36 @@ class Acc_Ledger_PurchaseTest extends TestCase
|
|||
protected function setUp()
|
||||
{
|
||||
include 'global.php';
|
||||
$this->object=new Acc_Ledger_Purchase($g_connection,3);
|
||||
$this->object=new Acc_Ledger_Purchase($g_connection, 3);
|
||||
$this->array=array
|
||||
(
|
||||
"gDossier"=>25,
|
||||
"nb_item"=>1,
|
||||
"p_jrn"=>3,
|
||||
"p_jrn_predef"=>3,
|
||||
"action"=>"use_opd",
|
||||
"jrn_type"=>"ACH",
|
||||
"filter"=>"",
|
||||
"e_date"=>"24.02.2018",
|
||||
"e_ech"=>"",
|
||||
"e_client"=>"FOURNI",
|
||||
"e_pj"=>"ACH6",
|
||||
"e_pj_suggest"=>"ACH6",
|
||||
"e_comm"=>"Loyer Appartement",
|
||||
"e_march0"=>"LOYER",
|
||||
"e_march0_price"=>658.25,
|
||||
"e_quant0"=>1,
|
||||
"htva_march0"=>658.25,
|
||||
"e_march0_tva_id"=>4,
|
||||
"e_march0_tva_amount"=>0,
|
||||
"tva_march0"=>0,
|
||||
"tvac_march0"=>658.25,
|
||||
"p_action"=>"ach",
|
||||
"sa"=>"p",
|
||||
"e_mp"=>0,
|
||||
"view_invoice"=>"Enregistrer",
|
||||
"ac"=>"ACH"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -34,12 +69,35 @@ class Acc_Ledger_PurchaseTest extends TestCase
|
|||
|
||||
/**
|
||||
* @covers Acc_Ledger_Purchase::verify
|
||||
* @todo Implement testVerify().
|
||||
* @expectedException Exception
|
||||
*/
|
||||
public function testVerify()
|
||||
{
|
||||
$this->object->verify(array());
|
||||
|
||||
$this->object->verify_operation($this->array);
|
||||
$this->assertTrue(TRUE);
|
||||
|
||||
// Test date
|
||||
try
|
||||
{
|
||||
$array=$this->array;
|
||||
$array['e_date']="g";
|
||||
$this->object->verify_operation($array);
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->assertEquals(2, $e->getCode());
|
||||
}
|
||||
// Test Strict
|
||||
try
|
||||
{
|
||||
$array=$this->array;
|
||||
$array['e_date']="01.01.2018";
|
||||
$this->object->verify_operation($array);
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->assertEquals(13, $e->getCode());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -48,10 +106,24 @@ class Acc_Ledger_PurchaseTest extends TestCase
|
|||
*/
|
||||
public function testInsert()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
global $g_connection;
|
||||
$array=$this->array;
|
||||
$array["mt"]="1572704002.1732";
|
||||
$array["pa_id"]=array(2);
|
||||
$array["op"]=array(0);
|
||||
$array["amount_t0"]=658.25;
|
||||
$array['hplan']=array(array(-1));
|
||||
$array["val"]=array(array(658.25));
|
||||
$this->clean_operation();
|
||||
|
||||
$this->assertEquals(0,
|
||||
$g_connection->get_value ("select count(*) from jrn where jr_mt=$1",["1572704002.1732"]));
|
||||
|
||||
$this->object->insert($array);
|
||||
$this->assertEquals(1,
|
||||
$g_connection->get_value ("select count(*) from jrn where jr_mt=$1",["1572704002.1732"]));
|
||||
$this->clean_operation();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -60,10 +132,17 @@ class Acc_Ledger_PurchaseTest extends TestCase
|
|||
*/
|
||||
public function testInput()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
put_global([["key"=>"ac","value"=>"ACH"]]);
|
||||
$res=$this->object->input();
|
||||
\Noalyss\Facility::save_file(__DIR__."/file",
|
||||
"acc_ledger_purchase_input.html",
|
||||
\Noalyss\Facility::page_start().$res);
|
||||
$this->assertContains(
|
||||
'<OPTION VALUE="3" SELECTED>Achat</SELECT>',
|
||||
$res);
|
||||
$this->assertContains('<INPUT TYPE="hidden" id="jrn_type" NAME="jrn_type" VALUE="ACH"',$res);
|
||||
$this->assertContains('<td class="num"> <span id="tvac" >0.0</span> </td>',$res);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -72,57 +151,24 @@ class Acc_Ledger_PurchaseTest extends TestCase
|
|||
*/
|
||||
public function testConfirm()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$array=$this->array;
|
||||
$array["p_name"]=
|
||||
$ret=$this->object->confirm($array);
|
||||
\Noalyss\Facility::save_file(__DIR__."/file",
|
||||
"acc_ledger_purchase_confirm.html",
|
||||
\Noalyss\Facility::page_start().$ret);
|
||||
$this->assertContains('name="amount_t0" value="658.25"',$ret);
|
||||
$this->assertContains("value=\"Efface détail\" onClick=\"anc_key_clean('25','','658.25','','','0');",$ret);
|
||||
$this->assertContains('NAME="e_quant0" VALUE="1">',$ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger_Purchase::extra_info
|
||||
* @todo Implement testExtra_info().
|
||||
*/
|
||||
public function testExtra_info()
|
||||
private function clean_operation()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
global $g_connection;
|
||||
$g_connection->exec_sql("delete from jrn where jr_mt=$1", ["1572704002.1732"]);
|
||||
$g_connection->exec_sql("delete from jrnx where j_grpt not in (select jr_grpt_id from jrn)");
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger_Purchase::show_unpaid
|
||||
* @todo Implement testShow_unpaid().
|
||||
*/
|
||||
public function testShow_unpaid()
|
||||
{
|
||||
// OBSOLETE : function must be removed in the next code cleaning
|
||||
// $str_html=$this->object->show_unpaid();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger_Purchase::get_detail_purchase
|
||||
* @todo Implement testGet_detail_purchase().
|
||||
*/
|
||||
public function testGet_detail_purchase()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger_Purchase::heading_detail_purchase
|
||||
* @todo Implement testHeading_detail_purchase().
|
||||
*/
|
||||
public function testHeading_detail_purchase()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
|
|
@ -13,6 +14,12 @@ class Acc_Ledger_SoldTest extends TestCase
|
|||
*/
|
||||
protected $object;
|
||||
|
||||
/**
|
||||
* Data to include
|
||||
* @var type
|
||||
*/
|
||||
private $array;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
|
|
@ -21,6 +28,46 @@ class Acc_Ledger_SoldTest extends TestCase
|
|||
{
|
||||
include 'global.php';
|
||||
$this->object=new Acc_Ledger_Sold($g_connection, 2);
|
||||
$this->array=array(
|
||||
"ledger_type"=>"VEN",
|
||||
"ac"=>"COMPTA/VENMENU/VEN",
|
||||
"sa"=>"p",
|
||||
"gDossier"=>25,
|
||||
"nb_item"=>2,
|
||||
"p_jrn"=>2,
|
||||
"p_jrn_predef"=>2,
|
||||
"action"=>"use_opd",
|
||||
"jrn_type"=>"VEN",
|
||||
"filter"=>"",
|
||||
"e_date"=>"24.08.2019",
|
||||
"e_ech"=>"",
|
||||
"e_client"=>"CLIENT",
|
||||
"e_pj"=>"VEN10",
|
||||
"e_pj_suggest"=>"VEN10",
|
||||
"e_comm"=>"Vente Service",
|
||||
"e_march0"=>"DEPLAC",
|
||||
"e_march0_price"=>20,
|
||||
"e_quant0"=>1.21,
|
||||
"htva_march0"=>24.2,
|
||||
"e_march0_tva_id"=>1,
|
||||
"e_march0_tva_amount"=>5.08,
|
||||
"tva_march0"=>5.08,
|
||||
"tvac_march0"=>29.28,
|
||||
"e_march1"=>"MARCHA",
|
||||
"e_march1_price"=>48.5,
|
||||
"e_quant1"=>25,
|
||||
"htva_march1"=>1212.5,
|
||||
"e_march1_tva_id"=>1,
|
||||
"e_march1_tva_amount"=>254.63,
|
||||
"tva_march1"=>254.63,
|
||||
"tvac_march1"=>1467.13,
|
||||
"mp_date"=>"",
|
||||
"acompte"=>0,
|
||||
"e_comm_paiement"=>"",
|
||||
"e_mp"=>"0",
|
||||
"e_mp_qcode_1"=>"COMPTE",
|
||||
"e_mp_qcode_2"=>"",
|
||||
"view_invoice"=>"Enregistrer");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -31,62 +78,61 @@ class Acc_Ledger_SoldTest extends TestCase
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
private function clean_operation()
|
||||
{
|
||||
global $g_connection;
|
||||
$g_connection->exec_sql("delete from jrn where jr_mt=$1", ["1572714478.3155"]);
|
||||
$g_connection->exec_sql("delete from jrnx where j_grpt not in (select jr_grpt_id from jrn)");
|
||||
}
|
||||
/**
|
||||
* @covers Acc_Ledger_Sold::verify
|
||||
* @todo Implement testVerify().
|
||||
* @expectedException Exception
|
||||
*/
|
||||
public function testVerify()
|
||||
{
|
||||
$this->object->verify(array());
|
||||
$this->object->verify_operation($this->array);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger_Sold::insert
|
||||
* @todo Implement testInsert().
|
||||
* @expectedException Exception
|
||||
*/
|
||||
public function testInsert()
|
||||
{
|
||||
$this->object->insert(array());
|
||||
global $g_connection;
|
||||
$array=$this->array;
|
||||
$array["pa_id"]=array(2);
|
||||
$array["op"]=array(0, 1);
|
||||
$array["amount_t0"]=24.2;
|
||||
$array["hplan"]=array(array(-1), array(-1));
|
||||
$array["val"]=array(array(24, 2), array(1212.5));
|
||||
$array["mt"]="1572714478.3155";
|
||||
$this->clean_operation();
|
||||
$cnt=$g_connection->get_value("select count(*) from jrn where jr_mt=$1",["1572714478.3155"]);
|
||||
$this->assertEquals(0,$cnt);
|
||||
$this->object->insert($array);
|
||||
|
||||
$cnt=$g_connection->get_value("select count(*) from jrn where jr_mt=$1",["1572714478.3155"]);
|
||||
$this->assertEquals(1,$cnt);
|
||||
$this->clean_operation();
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger_Sold::confirm
|
||||
* @todo Implement testConfirm().
|
||||
* @expectedException Exception
|
||||
*/
|
||||
public function testConfirm()
|
||||
{
|
||||
$_POST['p_jrn']=$this->object->id;
|
||||
$this->object->confirm(array());
|
||||
$array=$this->array;
|
||||
$res=$this->object->confirm($array);
|
||||
\Noalyss\Facility::save_file(__DIR__."/file"
|
||||
, "acc_ledger_sold_confirm.html"
|
||||
, \Noalyss\Facility::page_start().$res);
|
||||
$this->assertContains(
|
||||
'<input type="button" class="button" value="Vérifiez Imputation Analytique" onClick="verify_ca(\'\');">',
|
||||
$res);
|
||||
$this->assertContains('id="e_march1_tva_id" NAME="e_march1_tva_id" VALUE="1"', $res);
|
||||
$this->assertContains("anc_key_choice(25,'t1',1212.5,'');", $res);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger_Sold::extra_info
|
||||
* @todo Implement testExtra_info().
|
||||
*/
|
||||
public function testExtra_info()
|
||||
{
|
||||
$info=$this->object->extra_info();
|
||||
if (!is_string($info))
|
||||
{
|
||||
$this->assertTrue(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger_Sold::show_unpaid
|
||||
* @todo Implement testShow_unpaid().
|
||||
*/
|
||||
public function testShow_unpaid()
|
||||
{
|
||||
// OBSOLETE : must be removed
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Acc_Ledger_Sold::input
|
||||
|
|
@ -95,11 +141,20 @@ class Acc_Ledger_SoldTest extends TestCase
|
|||
public function testInput()
|
||||
{
|
||||
$_REQUEST['ac']='VEN';
|
||||
$info=$this->object->input();
|
||||
$info=$this->object->input($this->array);
|
||||
if (!is_string($info))
|
||||
{
|
||||
$this->assertTrue(FALSE);
|
||||
}
|
||||
\Noalyss\Facility::save_file(__DIR__."/file", "acc_ledger_sold_input.html",
|
||||
\Noalyss\Facility::page_start().
|
||||
$info);
|
||||
$this->assertContains(
|
||||
'NAME="e_client" ID="e_client" VALUE="CLIENT" SIZE="20" ondblclick="fill_ipopcard(this);" ', $info);
|
||||
$this->assertContains(
|
||||
'<INPUT TYPE="TEXT" class="input_text" id="e_pj" name="e_pj" value="VEN10" placeholder="" title=""',
|
||||
$info);
|
||||
$this->assertContains('ID="add_item" VALUE="Ajout article" onClick="ledger_add_row()">', $info);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -46,9 +46,9 @@ class Acc_OperationTest extends TestCase
|
|||
*/
|
||||
public function testSeek_group()
|
||||
{
|
||||
$this->object->jr_id=39;
|
||||
$this->object->jr_id=6;
|
||||
$r=$this->object->seek_group();
|
||||
$this->assertEquals(2922,$r);
|
||||
$this->assertEquals(8,$r);
|
||||
}
|
||||
/**
|
||||
* @covers Acc_Operation::set_id
|
||||
|
|
@ -74,6 +74,7 @@ class Acc_OperationTest extends TestCase
|
|||
$row=$this->object->db->get_array('select * from jrn where jr_rapt <> $1 limit 1',array('paid'));
|
||||
if ( ! $row ) {
|
||||
echo "Aucune ligne trouvée";
|
||||
$this->assertTrue(TRUE);
|
||||
} else {
|
||||
$this->object->jr_id=$row[0]['jr_id'];
|
||||
$this->object->set_paid();
|
||||
|
|
|
|||
|
|
@ -41,13 +41,20 @@ class Acc_Parm_CodeTest extends TestCase
|
|||
{
|
||||
|
||||
$a_result=$this->object->load_all();
|
||||
$err=0;
|
||||
for ($i=0;$i<count($a_result);$i++)
|
||||
{
|
||||
$code=$a_result[$i]->p_code;
|
||||
if (! in_array($code, array('BANQUE','CAISSE','COMPTE_COURANT','COMPTE_TVA',
|
||||
'CUSTOMER','DEP_PRIV','DNA','SUPPLIER','TVA_DED_IMPOT','TVA_DNA','VENTE','VIREMENT_INTERNE')))
|
||||
$this->assertNull('code inconnu'.$code);
|
||||
{
|
||||
$err++;
|
||||
$this->assertNull('code inconnu'.$code);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
$this->assertEquals(0,$err);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.'
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ class Noalyss_Parameter_FolderTest extends TestCase
|
|||
"MY_DATE_SUGGEST,".
|
||||
"MY_ALPHANUM,".
|
||||
"MY_UPDLAB,".
|
||||
"MY_ANC_FILTER,".
|
||||
"MY_STOCK");
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/*
|
||||
* This file is part of NOALYSS.
|
||||
*
|
||||
|
|
@ -23,10 +25,10 @@ use PHPUnit\Framework\TestCase;
|
|||
* @file
|
||||
* @brief
|
||||
*/
|
||||
|
||||
class Tax_SummaryTest extends TestCase
|
||||
{
|
||||
/**
|
||||
|
||||
/**
|
||||
* @var Acc_Account
|
||||
*/
|
||||
protected $object;
|
||||
|
|
@ -35,130 +37,619 @@ class Tax_SummaryTest extends TestCase
|
|||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp() :void
|
||||
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 {
|
||||
try
|
||||
{
|
||||
$this->object->check();
|
||||
$this->assertTrue(TRUE);
|
||||
} catch(Exception $e) {
|
||||
$this->assertSame('OK',$e->getMessage());
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->assertSame('OK', $e->getMessage());
|
||||
}
|
||||
// Warning expected
|
||||
try {
|
||||
try
|
||||
{
|
||||
$this->object->set_date_start("01.01.2090");
|
||||
$this->object->check();
|
||||
$this->assertTrue(FALSE);
|
||||
} catch(Exception $e) {
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->assertTrue(TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
function testDisplay()
|
||||
{
|
||||
$this->expectOutputRegex("/.*10\.737,34.*\<\/tr\>\<\/table\>\n/");
|
||||
$this->expectOutputRegex("/.*0,00.*\<\/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']]);
|
||||
//-- For creating the array
|
||||
Noalyss\Facility::save_file(__DIR__."/file", "tax_summary_getrow_purchase.txt", print_r($array, TRUE));
|
||||
$a_result=array
|
||||
(
|
||||
"0"=>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
|
||||
),
|
||||
"1"=>array
|
||||
(
|
||||
"jrn_def_name"=>"Achat",
|
||||
"tva_label"=>"12%",
|
||||
"tva_rate"=>0.1200,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>2,
|
||||
"amount_vat"=>109.8000,
|
||||
"amount_wovat"=>915.0000,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
),
|
||||
"2"=>array
|
||||
(
|
||||
"jrn_def_name"=>"Achat",
|
||||
"tva_label"=>"21%",
|
||||
"tva_rate"=>0.2100,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>1,
|
||||
"amount_vat"=>6.1000,
|
||||
"amount_wovat"=>29.0000,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
),
|
||||
"3"=>array
|
||||
(
|
||||
"jrn_def_name"=>"Achat",
|
||||
"tva_label"=>"6%",
|
||||
"tva_rate"=>0.0600,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>3,
|
||||
"amount_vat"=>5.2800,
|
||||
"amount_wovat"=>88.3200,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
),
|
||||
"4"=>array
|
||||
(
|
||||
"jrn_def_name"=>"Achat",
|
||||
"tva_label"=>"ART44",
|
||||
"tva_rate"=>0.0000,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>8,
|
||||
"amount_vat"=>0.0000,
|
||||
"amount_wovat"=>315.2000,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
),
|
||||
"5"=>array
|
||||
(
|
||||
"jrn_def_name"=>"Achat",
|
||||
"tva_label"=>"EXPORT",
|
||||
"tva_rate"=>0.0000,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>6,
|
||||
"amount_vat"=>0.0000,
|
||||
"amount_wovat"=>286.9500,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
),
|
||||
"6"=>array
|
||||
(
|
||||
"jrn_def_name"=>"Achat",
|
||||
"tva_label"=>"IMMO",
|
||||
"tva_rate"=>0.2100,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>1002,
|
||||
"amount_vat"=>319.2400,
|
||||
"amount_wovat"=>1520.2000,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
),
|
||||
"7"=>array
|
||||
(
|
||||
"jrn_def_name"=>"Achat",
|
||||
"tva_label"=>"VOIT",
|
||||
"tva_rate"=>0.2100,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>1003,
|
||||
"amount_vat"=>21.0000,
|
||||
"amount_wovat"=>100.0000,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
),
|
||||
"8"=>array
|
||||
(
|
||||
"jrn_def_name"=>"Frais Divers",
|
||||
"tva_label"=>"21%",
|
||||
"tva_rate"=>0.2100,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>1,
|
||||
"amount_vat"=>244.5500,
|
||||
"amount_wovat"=>1164.5400,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
),
|
||||
"9"=>array
|
||||
(
|
||||
"jrn_def_name"=>"Frais Divers",
|
||||
"tva_label"=>"EXPORT",
|
||||
"tva_rate"=>0.0000,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>6,
|
||||
"amount_vat"=>0.0000,
|
||||
"amount_wovat"=>259.8000,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
),
|
||||
"10"=>array
|
||||
(
|
||||
"jrn_def_name"=>"Frais Divers",
|
||||
"tva_label"=>"IMMO",
|
||||
"tva_rate"=>0.2100,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>1002,
|
||||
"amount_vat"=>319.2400,
|
||||
"amount_wovat"=>1520.2000,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
),
|
||||
"11"=>array
|
||||
(
|
||||
"jrn_def_name"=>"Frais Divers",
|
||||
"tva_label"=>"INTRA",
|
||||
"tva_rate"=>0.0000,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>5,
|
||||
"amount_vat"=>0.0000,
|
||||
"amount_wovat"=>1250.0000,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
),
|
||||
"12"=>array
|
||||
(
|
||||
"jrn_def_name"=>"Frais Divers",
|
||||
"tva_label"=>"VOIT",
|
||||
"tva_rate"=>0.2100,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>1003,
|
||||
"amount_vat"=>42.0000,
|
||||
"amount_wovat"=>200.0000,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000,
|
||||
)
|
||||
);
|
||||
$nb_result=count($a_result);
|
||||
$nb_array=count($array);
|
||||
$this->assertEquals($nb_result, $nb_array);
|
||||
$ix=0;
|
||||
for ($i=0; $i<$nb_result; $i++)
|
||||
{
|
||||
$row=$a_result[$i];
|
||||
for ($e=0; $e<$nb_array; $e++)
|
||||
{
|
||||
if (
|
||||
$row['qp_vat_code']==$array[$e]['qp_vat_code']
|
||||
&& $row['jrn_def_name'] == $array[$e]["jrn_def_name"]
|
||||
)
|
||||
{
|
||||
$this->assertEquals($row['amount_vat'], $array[$e]['amount_vat']
|
||||
,sprintf("Code %s ",$row['qp_vat_code']));
|
||||
$this->assertEquals($row['amount_wovat'], $array[$e]['amount_wovat']
|
||||
,sprintf("Code %s ",$row['qp_vat_code']));
|
||||
$this->assertEquals($row['amount_sided'], $array[$e]['amount_sided']
|
||||
,sprintf("Code %s ",$row['qp_vat_code']));
|
||||
$this->assertEquals($row['amount_noded_amount'], $array[$e]['amount_noded_amount']
|
||||
,sprintf("Code %s ",$row['qp_vat_code']));
|
||||
$this->assertEquals($row['amount_noded_tax'], $array[$e]['amount_noded_tax']
|
||||
,sprintf("Code %s ",$row['qp_vat_code']));
|
||||
$this->assertEquals($row['amount_noded_return'], $array[$e]['amount_noded_return']
|
||||
,sprintf("Code %s ",$row['qp_vat_code']));
|
||||
$this->assertEquals($row['amount_private'], $array[$e]['amount_private']
|
||||
,sprintf("Code %s ",$row['qp_vat_code']));
|
||||
$ix++;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->assertEquals($nb_array, $ix, 'Not all VAT CODE found');
|
||||
}
|
||||
|
||||
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'
|
||||
]]);
|
||||
|
||||
//-- For creating the array
|
||||
//Noalyss\Facility::save_file(__DIR__."/file", "tax_summary_getrow_sale.txt", print_r($array, TRUE));
|
||||
$a_result=array
|
||||
(
|
||||
"0"=>array
|
||||
(
|
||||
"jrn_def_name"=>"Vente",
|
||||
"tva_label"=>"21%",
|
||||
"qs_vat_code"=>1,
|
||||
"tva_rate"=>0.2100,
|
||||
"tva_both_side"=>0,
|
||||
"amount_vat"=>219.5700,
|
||||
"amount_wovat"=>1045.6000,
|
||||
"amount_sided"=>0.0000
|
||||
),
|
||||
"1"=>array
|
||||
(
|
||||
"jrn_def_name"=>"Vente",
|
||||
"tva_label"=>"EXPORT",
|
||||
"qs_vat_code"=>6,
|
||||
"tva_rate"=>0.0000,
|
||||
"tva_both_side"=>0,
|
||||
"amount_vat"=>0.0000,
|
||||
"amount_wovat"=>1047.9000,
|
||||
"amount_sided"=>0.0000
|
||||
),
|
||||
"2"=>array
|
||||
(
|
||||
"jrn_def_name"=>"Vente",
|
||||
"tva_label"=>"INTRA",
|
||||
"qs_vat_code"=>5,
|
||||
"tva_rate"=>0.0000,
|
||||
"tva_both_side"=>0,
|
||||
"amount_vat"=>0.0000,
|
||||
"amount_wovat"=>1800.0000,
|
||||
"amount_sided"=>0.0000
|
||||
),
|
||||
"3"=>array
|
||||
(
|
||||
"jrn_def_name"=>"Vente",
|
||||
"tva_label"=>"VOIT",
|
||||
"qs_vat_code"=>1003,
|
||||
"tva_rate"=>0.2100,
|
||||
"tva_both_side"=>0,
|
||||
"amount_vat"=>8.4000,
|
||||
"amount_wovat"=>40.0000,
|
||||
"amount_sided"=>0.0000
|
||||
),
|
||||
"4"=>Array
|
||||
(
|
||||
"jrn_def_name"=>"Vente différée",
|
||||
"tva_label"=>"EXPORT",
|
||||
"qs_vat_code"=>6,
|
||||
"tva_rate"=>0.0000,
|
||||
"tva_both_side"=>0,
|
||||
"amount_vat"=>0.0000,
|
||||
"amount_wovat"=>150.5600,
|
||||
"amount_sided"=>0.0000
|
||||
)
|
||||
);
|
||||
$nb_result=count($a_result);
|
||||
$nb_array=count($array);
|
||||
$this->assertEquals($nb_result, $nb_array);
|
||||
$ix=0;
|
||||
for ($i=0; $i<$nb_result; $i++)
|
||||
{
|
||||
$row=$a_result[$i];
|
||||
for ($e=0; $e<$nb_array; $e++)
|
||||
{
|
||||
if (
|
||||
$row['qs_vat_code']==$array[$e]['qs_vat_code']&&$row['jrn_def_name']==$array[$e]["jrn_def_name"]
|
||||
)
|
||||
{
|
||||
$this->assertEquals($row['amount_vat'], $array[$e]['amount_vat']
|
||||
, sprintf("Code %s ", $row['qs_vat_code']));
|
||||
$this->assertEquals($row['amount_wovat'], $array[$e]['amount_wovat']
|
||||
, sprintf("Code %s ", $row['qs_vat_code']));
|
||||
$this->assertEquals($row['amount_sided'], $array[$e]['amount_sided']
|
||||
, sprintf("Code %s ", $row['qs_vat_code']));
|
||||
$ix++;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->assertEquals($nb_array, $ix, 'Not all VAT CODE found');
|
||||
}
|
||||
|
||||
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'
|
||||
]]);
|
||||
|
||||
//-- For creating the array
|
||||
// \Noalyss\Facility::save_file(__DIR__."/file", "tax_summary_summary_purchase.txt", print_r($array, TRUE));
|
||||
$a_result=array
|
||||
(
|
||||
"0"=>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
|
||||
),
|
||||
"1"=>array
|
||||
(
|
||||
"tva_label"=>"12%",
|
||||
"tva_rate"=>0.1200,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>2,
|
||||
"amount_vat"=>109.8000,
|
||||
"amount_wovat"=>915.0000,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
),
|
||||
"2"=>array
|
||||
(
|
||||
"tva_label"=>"21%",
|
||||
"tva_rate"=>0.2100,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>1,
|
||||
"amount_vat"=>250.6500,
|
||||
"amount_wovat"=>1193.5400,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
),
|
||||
"3"=>array
|
||||
(
|
||||
"tva_label"=>"6%",
|
||||
"tva_rate"=>0.0600,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>3,
|
||||
"amount_vat"=>5.2800,
|
||||
"amount_wovat"=>88.3200,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
),
|
||||
"4"=>array
|
||||
(
|
||||
"tva_label"=>"ART44",
|
||||
"tva_rate"=>0.0000,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>8,
|
||||
"amount_vat"=>0.0000,
|
||||
"amount_wovat"=>315.2000,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
),
|
||||
"5"=>array
|
||||
(
|
||||
"tva_label"=>"EXPORT",
|
||||
"tva_rate"=>0.0000,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>6,
|
||||
"amount_vat"=>0.0000,
|
||||
"amount_wovat"=>546.7500,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
),
|
||||
"6"=>array
|
||||
(
|
||||
"tva_label"=>"IMMO",
|
||||
"tva_rate"=>0.2100,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>1002,
|
||||
"amount_vat"=>638.4800,
|
||||
"amount_wovat"=>3040.4000,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
),
|
||||
"7"=>array
|
||||
(
|
||||
"tva_label"=>"INTRA",
|
||||
"tva_rate"=>0.0000,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>5,
|
||||
"amount_vat"=>0.0000,
|
||||
"amount_wovat"=>1250.0000,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
),
|
||||
"8"=>array
|
||||
(
|
||||
"tva_label"=>"VOIT",
|
||||
"tva_rate"=>0.2100,
|
||||
"tva_both_side"=>0,
|
||||
"qp_vat_code"=>1003,
|
||||
"amount_vat"=>63.0000,
|
||||
"amount_wovat"=>300.0000,
|
||||
"amount_sided"=>0.0000,
|
||||
"amount_noded_amount"=>0.0000,
|
||||
"amount_noded_tax"=>0.0000,
|
||||
"amount_noded_return"=>0.0000,
|
||||
"amount_private"=>0.0000
|
||||
)
|
||||
);
|
||||
$nb_result=count($a_result);
|
||||
$nb_array=count($array);
|
||||
$this->assertEquals($nb_result, $nb_array);
|
||||
$ix=0;
|
||||
for ($i=0; $i<$nb_result; $i++)
|
||||
{
|
||||
$row=$a_result[$i];
|
||||
for ($e=0; $e<$nb_array; $e++)
|
||||
{
|
||||
if ($row['qp_vat_code']==$array[$e]['qp_vat_code'])
|
||||
{
|
||||
$this->assertEquals($row['amount_vat'], $array[$e]['amount_vat']
|
||||
,sprintf("Code %s ",$row['qp_vat_code']));
|
||||
$this->assertEquals($row['amount_wovat'], $array[$e]['amount_wovat']
|
||||
,sprintf("Code %s ",$row['qp_vat_code']));
|
||||
$this->assertEquals($row['amount_sided'], $array[$e]['amount_sided']
|
||||
,sprintf("Code %s ",$row['qp_vat_code']));
|
||||
$this->assertEquals($row['amount_noded_amount'], $array[$e]['amount_noded_amount']
|
||||
,sprintf("Code %s ",$row['qp_vat_code']));
|
||||
$this->assertEquals($row['amount_noded_tax'], $array[$e]['amount_noded_tax']
|
||||
,sprintf("Code %s ",$row['qp_vat_code']));
|
||||
$this->assertEquals($row['amount_noded_return'], $array[$e]['amount_noded_return']
|
||||
,sprintf("Code %s ",$row['qp_vat_code']));
|
||||
$this->assertEquals($row['amount_private'], $array[$e]['amount_private']
|
||||
,sprintf("Code %s ",$row['qp_vat_code']));
|
||||
$ix++;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->assertEquals($nb_array, $ix, 'Not all VAT CODE found');
|
||||
}
|
||||
|
||||
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'
|
||||
]]);
|
||||
//-- For creating the array
|
||||
// Noalyss\Facility::save_file(__DIR__."/file", "tax_summary_summary_sale.txt", print_r($array, TRUE));
|
||||
|
||||
$a_result=array
|
||||
(
|
||||
array
|
||||
(
|
||||
"tva_label"=>"21%",
|
||||
"qs_vat_code"=>1,
|
||||
"tva_rate"=>0.2100,
|
||||
"tva_both_side"=>0,
|
||||
"amount_vat"=>219.5700,
|
||||
"amount_wovat"=>1045.6000,
|
||||
"amount_sided"=>0.0000
|
||||
),
|
||||
array
|
||||
(
|
||||
"tva_label"=>"EXPORT",
|
||||
"qs_vat_code"=>6,
|
||||
"tva_rate"=>0.0000,
|
||||
"tva_both_side"=>0,
|
||||
"amount_vat"=>0.0000,
|
||||
"amount_wovat"=>1198.4600,
|
||||
"amount_sided"=>0.0000
|
||||
),
|
||||
array
|
||||
(
|
||||
"tva_label"=>"INTRA",
|
||||
"qs_vat_code"=>5,
|
||||
"tva_rate"=>0.0000,
|
||||
"tva_both_side"=>0,
|
||||
"amount_vat"=>0.0000,
|
||||
"amount_wovat"=>1800.0000,
|
||||
"amount_sided"=>0.0000
|
||||
),
|
||||
array
|
||||
(
|
||||
"tva_label"=>"VOIT",
|
||||
"qs_vat_code"=>1003,
|
||||
"tva_rate"=>0.2100,
|
||||
"tva_both_side"=>0,
|
||||
"amount_vat"=>8.4000,
|
||||
"amount_wovat"=>40.0000,
|
||||
"amount_sided"=>0.0000
|
||||
)
|
||||
);
|
||||
$nb_result=count($a_result);
|
||||
$nb_array=count($array);
|
||||
$this->assertEquals($nb_result, $nb_array);
|
||||
$ix=0;
|
||||
for ($i=0; $i<$nb_result; $i++)
|
||||
{
|
||||
$row=$a_result[$i];
|
||||
for ($e=0; $e<$nb_array; $e++)
|
||||
{
|
||||
if ($row['qs_vat_code']==$array[$e]['qs_vat_code'])
|
||||
{
|
||||
$this->assertEquals($row['amount_vat'], $array[$e]['amount_vat']
|
||||
,sprintf("Code %s ",$row['qs_vat_code']));
|
||||
$this->assertEquals($row['amount_wovat'], $array[$e]['amount_wovat']
|
||||
,sprintf("Code %s ",$row['qs_vat_code']));
|
||||
$this->assertEquals($row['amount_sided'], $array[$e]['amount_sided']
|
||||
,sprintf("Code %s ",$row['qs_vat_code']));
|
||||
$ix++;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->assertEquals($nb_array, $ix, 'Not all VAT CODE found');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
18
unit-test/jrn.csv
Normal file
18
unit-test/jrn.csv
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
jr_id,jr_def_id,jr_montant,jr_comment,jr_date,jr_grpt_id,jr_internal,jr_tech_date,jr_tech_per,jrn_ech,jr_ech,jr_rapt,jr_valid,jr_opid,jr_c_opid,jr_pj,jr_pj_name,jr_pj_type,jr_pj_number,jr_mt,jr_date_paid
|
||||
"1","3","146.4100","","2014-08-28","3","A000001","2014-08-28 17:53:24.755317","99",,,,"t",,,,,,"ACH1","1409241201.1562",
|
||||
"3","3","202.0700","","2014-08-28","5","A000003","2014-09-13 15:34:19.25992","99",,,,"t",,,,,,"ACH3","1410615199.5593",
|
||||
"4","3","202.0700","","2014-08-28","6","A000004","2014-09-13 16:54:52.202829","99",,,,"t",,,,,,"ACH4","1410619351.7227",
|
||||
"5","3","202.0700","","2014-08-28","7","A000005","2014-09-13 16:55:41.921773","99",,,,"t",,,,,,"ACH6","1410620127.6059",
|
||||
"6","3","55.6600","","2014-08-28","8","A000006","2014-09-14 16:19:50.015866","99",,,,"t",,,,,,"ACH8","1410704378.3556",
|
||||
"7","3","55.6600","","2014-08-28","9","A000007","2014-09-14 16:20:21.53739","99",,,,"t",,,,,,"ACH9","1410704406.2889",
|
||||
"8","3","55.6600","","2014-08-28","10","A000008","2014-09-14 16:25:25.223477","99",,,,"t",,,,,,"ACH11","1410704712.7114",
|
||||
"9","3","55.6600","","2014-08-28","11","A000009","2014-09-14 16:29:37.365348","99",,,,"t",,,,,,"ACH13","1410704965.6442",
|
||||
"10","3","55.6600","","2014-08-28","13","A00000B","2014-09-14 16:33:20.104077","99",,,,"t",,,,,,"ACH15","1410705109.1476",
|
||||
"2","3","146.4100","","2014-08-28","4","A000002","2014-09-12 22:27:14.991746","99",,,,"t",,,,,,"ACH2","1410553517.1469",
|
||||
"11","3","55.6600","","2014-08-28","16","A00000E","2014-09-14 16:36:46.455321","99",,,,"t",,,,,,"ACH17","1410705241.3828",
|
||||
"12","3","146.4100","","2014-08-28","17","A00000F","2014-09-15 00:05:06.829017","99",,,,"t",,,,,,"ACH18","1410732301.987",
|
||||
"13","3","146.4100","","2014-08-28","18","A000010","2014-09-16 20:56:35.623517","99",,,,"t",,,,,,"ACH19","1410893782.0265",
|
||||
"14","3","55.6600","","2014-08-28","19","A000011","2014-09-17 20:27:46.676824","99",,,,"t",,,,,,"ACH20","1410977970.5959",
|
||||
"16","2","186.4900","","2014-09-02","21","V000013","2014-11-02 20:23:15.250815","100",,,,"t",,,,,,"VEN2","1414956188.5832",
|
||||
"15","2","1697.0100","","2014-09-01","20","V000012","2014-11-02 20:22:50.431444","100",,,,"t",,,,,,"VEN1","1414956163.4927","2014-11-02"
|
||||
"17","1","1697.1000"," compte : Banque a Dupont","2014-11-02","22","F000014","2014-11-02 20:25:19.529644","102",,,,"t",,,,,,"FIN1","1414956317.8088",
|
||||
|
|
|
@ -1,9 +1,42 @@
|
|||
#!/bin/bash
|
||||
|
||||
help(){
|
||||
echo "$0 -f filename [-i function ]"
|
||||
echo " -f filename , file to test"
|
||||
echo " -i function , optional filter to a function"
|
||||
}
|
||||
PHPUNIT=./phpunit
|
||||
if [ ! -f "$1" ] ; then
|
||||
echo "File $1 not found"
|
||||
FILETOTEST=""
|
||||
FUNCTION=""
|
||||
while getopts "f:i:" opt; do
|
||||
case $opt in
|
||||
f)
|
||||
FILETOTEST=$OPTARG
|
||||
;;
|
||||
i)
|
||||
FUNCTION=$OPTARG
|
||||
;;
|
||||
*)
|
||||
help
|
||||
exit 1
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -z "$FILETOTEST" ] ;then
|
||||
help
|
||||
echo "-f is mandatory"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ ! -f "$FILETOTEST" ] ; then
|
||||
echo "File $FILETOTEST not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
$PHPUNIT --bootstrap bootstrap.php --color $1
|
||||
if [ ! -z "$FUNCTION" ] ; then
|
||||
echo "testing $FILETOTEST $FUNCTION"
|
||||
$PHPUNIT --bootstrap bootstrap.php --verbose --color --filter $FUNCTION $FILETOTEST
|
||||
else
|
||||
|
||||
$PHPUNIT --bootstrap bootstrap.php --color $FILETOTEST
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue