rewrite unit test for scenario

This commit is contained in:
Dany wm 2024-10-21 15:51:56 +02:00 committed by sparkyx
parent 9e5489a98c
commit 53a7cfb86c
64 changed files with 229 additions and 548 deletions

View file

@ -31,16 +31,11 @@
include_once("../include/constant.php");
include_once("lib/ac_common.php");
require_once('class/database.class.php');
require_once ('class/dossier.class.php');
require_once('lib/html_input.class.php');
require_once('lib/icon_action.class.php');
require_once ('lib/function_javascript.php');
require_once 'class/noalyss_user.class.php';
require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
html_page_start();
global $http;
define ('TEST_UNIT',1);
$http=new HttpInput();
@ -67,8 +62,8 @@ define('ALLOWED', 1);
load_all_script();
// To enable assert , set "zend.assertions" in the php.ini file
ini_set("assert.active",1);
assert_options(ASSERT_ACTIVE, 1);
assert_options(ASSERT_WARNING, 1);
// assert_options(ASSERT_ACTIVE, 1);
// assert_options(ASSERT_WARNING, 1);
//removed in PHP8 assert_options(ASSERT_QUIET_EVAL, 1);
function my_assert_handler($file, $line, $code)
{
@ -77,7 +72,6 @@ function my_assert_handler($file, $line, $code)
Line '$line'<br />
Code '$code'<br /><hr />";
}
assert_options(ASSERT_CALLBACK, 'my_assert_handler');
/******************************************************************************************************************/
/* Utilities
/******************************************************************************************************************/
@ -97,34 +91,43 @@ function get_card_with_activity() {
}
/*
* Loading of all scenario
* Loading of all scenario HTML + XML
*/
$scan=scandir('../scenario/');
$maxscan=count($scan);
$cnt_scenario=0;$scenario=array();
function retrieve_files($directory) :array
{
$scan=scandir($directory);
$maxscan=count($scan);
$cnt_scenario=0;$scenario=array();
for ($e_scan=0; $e_scan<$maxscan; $e_scan++)
{
if (is_file('../scenario/'.$scan[$e_scan])&&strpos($scan[$e_scan], '.php')==true)
for ($e_scan=0; $e_scan<$maxscan; $e_scan++)
{
$description="";
$a_description=file('../scenario/'.$scan[$e_scan]);
$max_description=count($a_description);
for ($w=0; $w<$max_description; $w++)
if (is_file("{$directory}/".$scan[$e_scan])&&strpos($scan[$e_scan], '.php')==true)
{
if (strpos($a_description[$w], '@description:')==true)
$description="";
$a_description=file("{$directory}/".$scan[$e_scan]);
$max_description=count($a_description);
for ($w=0; $w<$max_description; $w++)
{
$description=$a_description[$w];
$description=noalyss_str_replace('//@description:', '', $description);
if (strpos($a_description[$w], '@description:')==true)
{
$description=$a_description[$w];
$description=noalyss_str_replace('//@description:', '', $description);
}
}
$scenario[$cnt_scenario]['file']="{$directory}/".$scan[$e_scan];
$scenario[$cnt_scenario]['desc']=$description;
$cnt_scenario++;
}
$scenario[$cnt_scenario]['file']=$scan[$e_scan];
$scenario[$cnt_scenario]['desc']=$description;
$cnt_scenario++;
}
}
return $scenario;
}
$html_files=retrieve_files(NOALYSS_BASE.'/scenario/HTML');
$xml_files=retrieve_files(NOALYSS_BASE.'/scenario/XML');
$lib_files=retrieve_files(NOALYSS_BASE.'/scenario/LIB');
$script=$http->request('script', "string",'');
$min=$cn->get_value("select p_id from parm_periode order by p_start asc limit 1");
$max=$cn->get_value("select p_id from parm_periode order by p_start desc limit 1");
@ -137,7 +140,8 @@ if ($script=="")
* cherche pour fichier a include, s'il y en a alors les affiche
* avec une description
*/
echo h1('HTML');
echo '<table>';
$get='test.php?'.http_build_query(array('script'=>"all", 'gDossier'=>$gDossierLogInput, 'description'=>"Tous les scripts"));
@ -149,23 +153,70 @@ if ($script=="")
echo '</td>';
echo '<td>Tous les scripts</td>';
echo '</tr>';
for ($e=0; $e<$cnt_scenario; $e++)
$nb_html=count($html_files);
for ($e=0; $e<$nb_html; $e++)
{
$get='test.php?'.http_build_query(array('script'=>$scenario[$e]['file'], 'gDossier'=>$gDossierLogInput, 'description'=>$scenario[$e]['desc']));
$get='test.php?'.http_build_query(array('script'=>$html_files[$e]['file'], 'gDossier'=>$gDossierLogInput, 'description'=>$html_files[$e]['desc']));
echo '<tr>';
echo '<td>';
echo $e;
echo '</td>';
echo '<td>';
echo '<a href="'.$get.'" target="_blank">';
echo $scenario[$e]['file'];
echo basename($html_files[$e]['file']);
echo '</a>';
echo '</td>';
echo '<td>'.$scenario[$e]['desc'].'</td>';
echo '<td>'.$html_files[$e]['desc'].'</td>';
echo '</tr>';
}
echo '</table>';
echo h1('XML');
echo '<table>';
$nb_xml=count($xml_files);
for ($e=0; $e<$nb_xml; $e++)
{
$get='test.php?'.http_build_query(array('script'=>$xml_files[$e]['file'], 'gDossier'=>$gDossierLogInput, 'description'=>$xml_files[$e]['desc']));
echo '<tr>';
echo '<td>';
echo $e;
echo '</td>';
echo '<td>';
echo '<a href="'.$get.'" target="_blank">';
echo basename($xml_files[$e]['file']);
echo '</a>';
echo '</td>';
echo '<td>'.$xml_files[$e]['desc'].'</td>';
echo '</tr>';
}
echo '</table>';
echo h1('Libraries');
echo '<table>';
$nb_lib=count($lib_files);
for ($e=0; $e<$nb_lib; $e++)
{
$get='test.php?'.http_build_query(array('script'=>$lib_files[$e]['file'], 'gDossier'=>$gDossierLogInput, 'description'=>$lib_files[$e]['desc']));
echo '<tr>';
echo '<td>';
echo $e;
echo '</td>';
echo '<td>';
echo '<a href="'.$get.'" target="_blank">';
echo basename($lib_files[$e]['file']);
echo '</a>';
echo '</td>';
echo '<td>'.$lib_files[$e]['desc'].'</td>';
echo '</tr>';
}
echo '</table>';
}
@ -207,11 +258,10 @@ else
{
$start_mem=memory_get_usage();
$start_time=microtime(true);
$script=noalyss_str_replace('../', '', $script);
$description=$http->get("description","string", "aucune description");
echo '<h1>'.$script."</h1>";
echo '<p> description = '.$description.'<p>';
include '../scenario/'.$script;
include $script;
$end_mem=memory_get_usage();
$end_time=microtime(true);

View file

@ -343,7 +343,7 @@ case 'st':
}
$xml=escape_xml($html);
header('Content-type: text/xml; charset=UTF-8');
if (!defined("TEST_UNIT")) header('Content-type: text/xml; charset=UTF-8');
echo <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<data>

View file

@ -94,8 +94,6 @@ if ($ledger == "") {
$html = escape_xml($html);
if (!headers_sent()) {
header('Content-type: text/xml; charset=UTF-8');
} else {
echo "HTML" . unescape_xml($html);
}
echo <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
@ -543,10 +541,9 @@ switch ($action) {
$html = escape_xml($html);
if (!headers_sent()) {
header('Content-type: text/xml; charset=UTF-8');
} else {
echo "HTML" . unescape_xml($html);
}
echo <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<data>

View file

@ -65,7 +65,7 @@ class PDF_Core extends TFPDF
private $cells=array();
protected $bigger;
public function __construct ( $orientation = 'P', $unit = 'mm', $format = 'A4')
{
$this->bigger=0;

View file

@ -1,5 +1,5 @@
<?php
//@description:ACH Appel menu Achat
//@description:ACH new purchase
$_GET=array (
'gDossier' => '42',
'ac' => 'COMPTA/MENUACH/ACH',

View file

@ -6,7 +6,7 @@ $_GET=array (
);
$_POST=array (
'gDossier' => '42',
'e_client' => 'IMMOB',
'e_client' => 'FOURNI1',
'nb_item' => '1',
'p_jrn' => '3',
'e_comm' => 'Loyer',
@ -15,7 +15,7 @@ $_POST=array (
'jrn_type' => 'ACH',
'e_pj' => 'ACH1',
'e_pj_suggest' => 'ACH1',
'mt' => '1415995238.7737',
'mt' => '141599523a8.7737',
'e_mp' => '0',
'e_march0' => 'LOYER',
'e_march0_price' => '2560',
@ -28,8 +28,12 @@ $_POST=array (
'opd_name' => 'Paiement loyer',
'od_description' => 'Paiement du loyer',
'record' => 'Enregistrement',
'p_currency_rate'=>1 ,
'p_currency_code'=>'0'
);
$_POST['gDossier']=$gDossierLogInput;
$_GET['gDossier']=$gDossierLogInput;
$_REQUEST=array_merge($_GET,$_POST);
html_page_start();
include 'compta_ach.inc.php';

View file

@ -10,13 +10,13 @@ $_POST=array (
'gDossier' => '42',
'nb_item' => '10',
'p_jrn' => '3',
'e_date' => '01.02.2016',
'e_date' => '01.02.2017',
'e_ech' => '',
'e_client' => 'DIV',
'e_client' => 'FOURNI1',
'e_pj' => 'ACH2',
'e_pj_suggest' => 'ACH2',
'e_comm' => 'Paiement loyer',
'e_march0' => 'FID15',
'e_march0' => 'LOYER',
'e_march0_label' => 'TEST',
'e_march0_price' => '2560.0000',
'e_quant0' => '1.0000',
@ -102,6 +102,8 @@ $_POST=array (
'sa' => 'p',
'e_mp' => '0',
'view_invoice' => 'Enregistrer',
'p_currency_rate'=>1 ,
'p_currency_code'=>'0'
);
$_POST['gDossier']=$gDossierLogInput;
$_GET['gDossier']=$gDossierLogInput;

View file

@ -12,7 +12,7 @@ $_POST=array (
'p_jrn' => '3',
'e_date' => '01.01.2017',
'e_ech' => '',
'e_client' => 'IMMOB',
'e_client' => 'FOURNI1',
'e_pj' => 'ACH2',
'e_pj_suggest' => 'ACH2',
'e_comm' => 'Paiement loyer',
@ -99,6 +99,8 @@ $_POST=array (
'jrn_type' => 'ACH',
'e_mp' => '0',
'view_invoice' => 'Enregistrer',
'p_currency_rate'=>1 ,
'p_currency_code'=>'0'
);
$_POST['gDossier']=$gDossierLogInput;
$_GET['gDossier']=$gDossierLogInput;

View file

@ -11,4 +11,5 @@ $_POST=array (
$_POST['gDossier']=$gDossierLogInput;
$_GET['gDossier']=$gDossierLogInput;
$_REQUEST=array_merge($_GET,$_POST);
html_page_start();
include 'compta_ach.inc.php';

View file

@ -1,5 +1,5 @@
<?php
//@description:ACHISTO
//@description:ACHISTO History Purchase
$_GET=array (
'gDossier' => '42',
'ac' => 'COMPTA/MENUACH/ACHISTO',
@ -9,4 +9,5 @@ $_POST=array (
$_POST['gDossier']=$gDossierLogInput;
$_GET['gDossier']=$gDossierLogInput;
$_REQUEST=array_merge($_GET,$_POST);
html_page_start();
include 'history_operation.inc.php';

View file

@ -1,5 +1,5 @@
<?php
//@description:ODHISTO
//@description:ODHISTO : history Misc. Operation
$_GET=array (
'gDossier' => '42',
'ac' => 'COMPTA/MENUODS/ODHISTO',
@ -10,4 +10,5 @@ $_POST=array (
$_POST['gDossier']=$gDossierLogInput;
$_GET['gDossier']=$gDossierLogInput;
$_REQUEST=array_merge($_GET,$_POST);
html_page_start();
include 'history_operation.inc.php';

View file

@ -18,11 +18,16 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright (2018) Author Dany De Bontridder <dany@alchimerys.be>
//@description:create a database (domaine).dossier1 , check the SQL for creating MOD1 and MOD2
$_POST['gDossier']=$gDossierLogInput;
$_GET['gDossier']=$gDossierLogInput;
$_REQUEST=array_merge($_GET,$_POST);
?>
<h1 class="">create a database </h1>
Create dossier1 with sql/mod1/schema.sql , data.sql and constraint.sql
<?php
/**
* @file
* @brief
@ -30,9 +35,14 @@ $_REQUEST=array_merge($_GET,$_POST);
*/
$cn=new Database();
$cn->exec_sql("create database ".domaine."dossier1 encoding='utf8'");
$cn=new Database(1, 'dos');
$cn->execute_script(NOALYSS_INCLUDE.'/sql/mod1/schema.sql');
$cn->execute_script(NOALYSS_INCLUDE.'/sql/mod1/data.sql');
$cn->execute_script(NOALYSS_INCLUDE.'/sql/mod1/constraint.sql');
echo Dossier::name(1);
?>

View file

@ -13,10 +13,10 @@ $_POST=array (
'first_sold' => '0',
'e_pj' => 'FIN1',
'e_pj_suggest' => 'FIN1',
'e_date' => '02.01.2014',
'e_date' => '02.01.2017',
'mt' => '1415995351.0398',
'sa' => 'n',
'e_other0' => 'IMMOB ',
'e_other0' => 'FOURNI ',
'e_other0_comment' => '',
'e_other0_amount' => '2560',
'e_concerned0' => '2',

View file

@ -10,17 +10,17 @@ $_POST=array (
'gDossier' => '42',
'nb_item' => '5',
'chdate' => '1',
'e_date' => '02.01.2014',
'e_date' => '02.01.2017',
'p_jrn' => '1',
'e_pj' => 'FIN1',
'e_pj_suggest' => 'FIN1',
'first_sold' => '0',
'last_sold' => '',
'dateop0' => '',
'e_other0' => 'IMMOB ',
'e_other_name0' => 'Immo Bureau',
'e_other0' => 'FOURNI',
'e_other_name0' => '',
'e_other0_comment' => '',
'e_other0_amount' => '2560',
'e_other0_amount' => '2560.12',
'e_concerned0' => '2',
'dateop1' => '',
'e_other1' => '',

View file

@ -27,27 +27,6 @@
* @brief Test the HtmlInput object it means the Inum, IText , ...
*/
require_once NOALYSS_INCLUDE.'/lib/html_input.class.php';
require_once NOALYSS_INCLUDE.'/lib/iaction.class.php';
require_once NOALYSS_INCLUDE.'/lib/ibutton.class.php';
require_once NOALYSS_INCLUDE.'/lib/icard.class.php';
require_once NOALYSS_INCLUDE.'/lib/icheckbox.class.php';
require_once NOALYSS_INCLUDE.'/lib/iconcerned.class.php';
require_once NOALYSS_INCLUDE.'/lib/idate.class.php';
require_once NOALYSS_INCLUDE.'/lib/ifile.class.php';
require_once NOALYSS_INCLUDE.'/lib/ihidden.class.php';
require_once NOALYSS_INCLUDE.'/lib/inum.class.php';
require_once NOALYSS_INCLUDE.'/lib/iperiod.class.php';
require_once NOALYSS_INCLUDE.'/lib/iposte.class.php';
require_once NOALYSS_INCLUDE.'/lib/iradio.class.php';
require_once NOALYSS_INCLUDE.'/lib/irelated_action.class.php';
require_once NOALYSS_INCLUDE.'/lib/iselect.class.php';
require_once NOALYSS_INCLUDE.'/lib/ispan.class.php';
require_once NOALYSS_INCLUDE.'/lib/itext.class.php';
require_once NOALYSS_INCLUDE.'/lib/itextarea.class.php';
require_once NOALYSS_INCLUDE.'/lib/itva_popup.class.php';
require_once NOALYSS_INCLUDE.'/lib/input_switch.class.php';
require_once NOALYSS_INCLUDE.'/lib/input_checkbox.class.php';
$http=new HttpInput();
?>

View file

@ -26,8 +26,7 @@ if (!defined('ALLOWED'))
* @file
* @brief Test of Html_Tab and Output_Html_Tab
*/
require_once NOALYSS_INCLUDE.'/lib/html_tab.class.php';
require_once NOALYSS_INCLUDE.'/lib/output_html_tab.class.php';
$tab = new Html_Tab('tab1',_("Titre 1"));
$tab->set_mode('link');

View file

@ -1,4 +1,4 @@
<?php
<?php
/*
* Copyright (C) 2018 Dany De Bontridder <dany@alchimerys.be>

View file

@ -36,14 +36,17 @@
<h1> smoke prompt</h1>
<pre>
function func_callback_prompt(ev)
function func_callback_prompt(ev)
{
if (ev) { alert ("accepted "+ev);}
console.debug(ev);
return true;
}
smoke.prompt('Confirmez-vous',func_callback_prompt,{title:"Titre"});
function smoke_prompt()
{
smoke.prompt('Donnez un élement',func_callback_prompt,{title:"Titre"});
}
</pre>
<script>
@ -60,3 +63,16 @@ smoke.prompt('Confirmez-vous',func_callback_prompt,{title:"Titre"});
</script>
<button onclick="smoke_prompt()">smoke_prompt</button>
<h1> smoke signal </h1>
<button onclick="signal()">Signal de 0.5 sec </button>
<script>
function signal() { smoke.signal('Sauvé',function(e){},{duration:500}); }
</script>
<pre>
function signal() { smoke.signal('Sauvé',function(e){},{duration:500}); }
</pre>

View file

@ -0,0 +1,34 @@
<?php
//@description:st montre choix des catégories de fiches
$_GET=array (
'gDossier' => '42',
'ctl' => 'select_card_div',
'op' => 'card',
'op2'=>'st',
'fil' => '-1',
'ledger' => '2',
);
$_POST['gDossier']=$gDossierLogInput;
$_GET['gDossier']=$gDossierLogInput;
$_REQUEST=array_merge($_GET,$_POST);
define ('TEST_UNIT',1);
ob_start();
include NOALYSS_HOME.'/ajax_misc.php';
$output=ob_get_clean();
echo '<HR>';
$xml=simplexml_load_string($output);
print "ctl {$xml->ctl}";
echo '<hr>';
print "code ";
print '<div style="width:60%;margin-left:20%">';
print_r($xml->code);
echo '</div>';
echo '<code>';
echo htmlentities($xml->code);
echo '</code>';
echo '<hr>';
print "fiche_cat ";
print_r($xml->fiche_cat);
echo '<hr>';

View file

@ -3,7 +3,7 @@
$_GET=array (
'op' => 'ledger',
'act' => 'de',
'jr_id' => '2856',
'jr_id' => '137',
'div' => 'det2',
);
$_POST=array (
@ -11,4 +11,10 @@ $_POST=array (
$_POST['gDossier']=$gDossierLogInput;
$_GET['gDossier']=$gDossierLogInput;
$_REQUEST=array_merge($_GET,$_POST);
define ('TEST_UNIT',1);
ob_start();
include 'ajax_misc.php';
$output=ob_get_contents();
ob_clean();
echo unescape_xml($output);
echo htmlentities($output);

View file

@ -1,9 +1,9 @@
<?php
//@description:de Detail operation
//@description:FIN Detail operation
$_GET=array (
'op' => 'ledger',
'act' => 'de',
'jr_id' => '2870',
'jr_id' => '147',
'div' => 'det2',
);
$_POST=array (
@ -11,4 +11,10 @@ $_POST=array (
$_POST['gDossier']=$gDossierLogInput;
$_GET['gDossier']=$gDossierLogInput;
$_REQUEST=array_merge($_GET,$_POST);
define ('TEST_UNIT',1);
ob_start();
include 'ajax_misc.php';
$output=ob_get_contents();
ob_clean();
echo unescape_xml($output);
echo htmlentities($output);

View file

@ -3,12 +3,17 @@
$_GET=array (
'op' => 'ledger',
'act' => 'de',
'jr_id' => '3532',
'jr_id' => '213',
'div' => 'det2',
);
$_POST=array (
);
$_POST['gDossier']=$gDossierLogInput;
$_GET['gDossier']=$gDossierLogInput;
$_REQUEST=array_merge($_GET,$_POST);
define ('TEST_UNIT',1);
ob_start();
include 'ajax_misc.php';
$output=ob_get_contents();
ob_clean();
echo unescape_xml($output);
echo htmlentities($output);

View file

@ -3,7 +3,7 @@
$_GET=array (
'op'=>"ledger",
'act' => 'de',
'jr_id' => '2826',
'jr_id' => '316',
'div' => 'det2',
);
$_POST=array (
@ -11,4 +11,10 @@ $_POST=array (
$_POST['gDossier']=$gDossierLogInput;
$_GET['gDossier']=$gDossierLogInput;
$_REQUEST=array_merge($_GET,$_POST);
define ('TEST_UNIT',1);
ob_start();
include 'ajax_misc.php';
$output=ob_get_contents();
ob_clean();
echo unescape_xml($output);
echo htmlentities($output);

View file

@ -1,34 +0,0 @@
<?php
//@description:ACH Encodage d'une vente
$_GET=array (
'gDossier' => '42',
'ac' => 'COMPTA/MENUACH/ACH',
);
$_POST=array (
'gDossier' => '42',
'nb_item' => '1',
'p_jrn' => '3',
'e_date' => '01.03.2016',
'e_ech' => '',
'e_client' => 'IMMOB',
'e_pj' => 'ACH1',
'e_pj_suggest' => 'ACH1',
'e_comm' => 'Loyer',
'e_march0' => 'LOYER',
'e_march0_price' => '2560',
'e_quant0' => '1',
'htva_march0' => '2560',
'e_march0_tva_id' => '4',
'e_march0_tva_amount' => '0',
'tva_march0' => '0',
'tvac_march0' => '2560',
'jrn_type' => 'ACH',
'p_action' => 'ach',
'sa' => 'p',
'e_mp' => '0',
'view_invoice' => 'Enregistrer',
);
$_POST['gDossier']=$gDossierLogInput;
$_GET['gDossier']=$gDossierLogInput;
$_REQUEST=array_merge($_GET,$_POST);
include 'compta_ach.inc.php';

View file

@ -1,16 +0,0 @@
<?php
//@description:st montre choix des catégories de fiches
$_GET=array (
'gDossier' => '42',
'ctl' => 'select_card_div',
'op' => 'card',
'op2'=>'st',
'fil' => '-1',
'ledger' => '2',
);
$_POST=array (
);
$_POST['gDossier']=$gDossierLogInput;
$_GET['gDossier']=$gDossierLogInput;
$_REQUEST=array_merge($_GET,$_POST);
include NOALYSS_HOME.'/ajax_misc.php';

View file

@ -1,37 +0,0 @@
<?php
//@description:save
$_GET=array (
);
$_POST=array (
'whatdiv' => 'det2',
'jr_id' => '2856',
'gDossier' => '27',
'p_date' => '05.12.2013',
'p_ech' => '',
'p_date_paid' => '',
'npj' => 'ACH607',
'lib' => 'Consommable, ptit matériel',
'jrn_note' => '',
'j_id' =>
array (
0 => '7629',
1 => '7630',
),
'BON_COMMANDE' => '',
'OTHER' => '',
'raptdet2' => '',
'related' => '327,231,330',
'Fermer' => 'Fermer',
'save' => 'Sauver',
'Effacer' => 'Effacer',
'bextdet2' => 'Extourner',
'rapt' => '',
'div' => 'det2',
'act' => 'save',
'op'=>'ledger',
'jr_optype'=>'NOR'
);
$_POST['gDossier']=$gDossierLogInput;
$_GET['gDossier']=$gDossierLogInput;
$_REQUEST=array_merge($_GET,$_POST);
include 'ajax_misc.php';

View file

@ -1,64 +0,0 @@
<?php
/*
* 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.
*
* NOALYSS 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 (2016) Author Dany De Bontridder <dany@alchimerys.be>
if (!defined('ALLOWED'))
die('Appel direct ne sont pas permis');
if ( ! defined ("AJAX_TEST")) {
echo "Can not be called directly but via ajax_test.php";
return;
}
/**
* @file
* @brief Test the ajax call from test_manage_table_sql.php
*/
$http=new HttpInput();
try {
$table=$http->request('table');
$action=$http->request('action');
$p_id=$http->request('p_id', "number");
$ctl_id=$http->request('ctl');
} catch(Exception $e) {
echo $e->getMessage();
}
require_once NOALYSS_INCLUDE."/lib/manage_table_sql.class.php";
require_once NOALYSS_INCLUDE."/class/acc_plan_mtable.class.php";
$obj=new Acc_Plan_SQL($cn);
$obj->set_limit_fiche_qcode(5);
$obj->set_pk_value($p_id);
$obj->load();
$manage_table=new Acc_Plan_MTable($obj);
$manage_table->add_json_param("TestAjaxFile",
NOALYSS_HOME."/../scenario/ajax_acc_plan_mtable.php");
$manage_table->set_object_name($ctl_id);
$manage_table->set_callback("ajax_test.php");
if ($action=="input")
{
header('Content-type: text/xml; charset=UTF-8');
echo $manage_table->ajax_input()->saveXML();
return;
}
elseif ($action == "save")
{
$xml=$manage_table->ajax_save();
header('Content-type: text/xml; charset=UTF-8');
echo $xml->saveXML();
}

View file

@ -1,79 +0,0 @@
<?php
/*
* 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.
*
* NOALYSS 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 (2016) Author Dany De Bontridder <dany@alchimerys.be>
if (!defined('ALLOWED'))
die('Appel direct ne sont pas permis');
if ( ! defined ("AJAX_TEST")) {
echo "Can not be called directly but via AJAX";
return;
}
/**
* @file
* @brief Test the ajax call from test_manage_table_sql.php
*/
$http=new HttpInput();
try {
$table=$http->request('table');
$action=$http->request('action');
$p_id=$http->request('p_id', "number");
$ctl_id=$http->request('ctl');
} catch(Exception $e) {
echo $e->getMessage();
}
require_once NOALYSS_INCLUDE."/lib/manage_table_sql.class.php";
require_once NOALYSS_INCLUDE."/database/acc_plan_sql.class.php";
if ($action=="input")
{
$obj=new Acc_Plan_SQL($cn);
$obj->set_limit_fiche_qcode(5);
$obj->set_pk_value($p_id);
$obj->load();
$manage_table=new Manage_Table_SQL($obj);
$manage_table->add_json_param("TestAjaxFile",
NOALYSS_HOME."/../scenario/ajax_manage_table_sql.php");
$manage_table->set_object_name($ctl_id);
$manage_table->set_col_label('pcm_val', "Poste");
$manage_table->set_col_label('parent_accounting', "Dépend");
$manage_table->set_col_label('pcm_lib', "Libellé");
$manage_table->set_col_label('pcm_type',
"Type de menu".Icon_Action::infobulle(33));
header('Content-type: text/xml; charset=UTF-8');
echo $manage_table->ajax_input()->saveXML();
return;
} elseif ($action=="save")
{
$obj=new Acc_Plan_SQL($cn);
$obj->set_limit_fiche_qcode(5);
$obj->set_pk_value($p_id);
$obj->load();
$manage_table=new Manage_Table_SQL($obj);
$manage_table->set_object_name($ctl_id);
$manage_table->add_json_param("TestAjaxFile",
NOALYSS_HOME."/../scenario/ajax_manage_table_sql.php");
header('Content-type: text/xml; charset=UTF-8');
echo $manage_table->ajax_save()->saveXML();
return;
}

View file

@ -1,19 +0,0 @@
<?php
//@description:C0PCMN Ajout d'un poste comptable
$_GET=array (
'gDossier' => '42',
'ac' => 'PARAM/C0PCMN',
);
$_POST=array (
'p_action' => 'pcmn',
'gDossier' => '42',
'p_val' => '4519',
'p_lib' => 'Compte TVA',
'p_parent' => '451',
'p_type' => 'ACT',
'Ajout' => 'Ajout',
);
$_POST['gDossier']=$gDossierLogInput;
$_GET['gDossier']=$gDossierLogInput;
$_REQUEST=array_merge($_GET,$_POST);
include 'param_pcmn.inc.php';

View file

@ -1,42 +0,0 @@
<?php
/*
* This file is part of NOALYSS.
*
* NOALYSS 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.
*
* NOALYSS 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 NOALYSS; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright Author Dany De Bontridder dany@alchimerys.be
//@description: Developpement for ANC
require_once NOALYSS_INCLUDE . "/class/anc_operation.class.php";
$anc = new Anc_Operation($cn);
$a_jrnxId = $cn->get_array(
"select j_id from jrnx join jrn on (jr_grpt_id=j_grpt)
where
jr_id=$1
", array(48));
$nb = count($a_jrnxId);
for ($i = 0; $i<$nb; $i++) {
// First row
$a = $anc->get_by_jid($a_jrnxId[$i]['j_id']);
if (! empty($a) ) {
$complete=$anc->to_request($a, 1);
var_dump($complete);
}
}

View file

@ -1,35 +0,0 @@
<?php
//@description:ODS Confirmation OD
$_GET=array (
'gDossier' => '42',
'ac' => 'COMPTA/MENUODS/ODS',
);
$_POST=array (
'ac' => 'COMPTA/MENUODS/ODS',
'e_date' => '14.11.2014',
'desc' => 'TVA',
'period' => '102',
'e_pj' => 'ODS1',
'e_pj_suggest' => 'ODS1',
'mt' => '1415996970.8822',
'e_comm' => 'TVA',
'jrn_type' => 'ODS',
'p_jrn' => '4',
'nb_item' => '5',
'jrn_concerned' => '',
'gDossier' => '42',
'poste0' => '4519',
'ld0' => 'Compte TVA',
'amount0' => '250',
'poste1' => '6700',
'ld1' => 'Paiement TVA',
'amount1' => '250',
'ck1' => '',
'opd_name' => 'Paiement TVA',
'od_description' => '',
'save' => 'Confirmer',
);
$_POST['gDossier']=$gDossierLogInput;
$_GET['gDossier']=$gDossierLogInput;
$_REQUEST=array_merge($_GET,$_POST);
include 'compta_ods.inc.php';

View file

@ -1,44 +0,0 @@
<?php
//@description:ODS Enregistrement
$_GET=array (
'gDossier' => '42',
'ac' => 'COMPTA/MENUODS/ODS',
);
$_POST=array (
'gDossier' => '42',
'ac' => 'COMPTA/MENUODS/ODS',
'p_jrn' => '4',
'e_date' => '14.11.2016',
'e_pj' => 'ODS1',
'e_pj_suggest' => 'ODS1',
'desc' => 'TVA',
'nb_item' => '5',
'jrn_type' => 'ODS',
'qc_0' => '',
'poste0' => '4519',
'ld0' => 'Compte TVA',
'amount0' => '250',
'qc_1' => '',
'poste1' => '6700',
'ld1' => 'Paiement TVA',
'amount1' => '250',
'ck1' => '',
'qc_2' => '',
'poste2' => '',
'ld2' => '',
'amount2' => '',
'qc_3' => '',
'poste3' => '',
'ld3' => '',
'amount3' => '',
'qc_4' => '',
'poste4' => '',
'ld4' => '',
'amount4' => '',
'jrn_concerned' => '',
'summary' => 'Sauvez',
);
$_POST['gDossier']=$gDossierLogInput;
$_GET['gDossier']=$gDossierLogInput;
$_REQUEST=array_merge($_GET,$_POST);
include 'compta_ods.inc.php';

View file

@ -37,7 +37,16 @@ L'objectif étant de pouvoir tester et de rejouer facilement les actions que vou
Il est aussi possible de faire vos tests unitaire ici , autrement qu'avec PHPUNIT (voir répertiore php-unit)
Vous pouver l'utiliser pour les sorties ajax, mises au point de librarie, scénario , cela permet de tester les
fichiers à include (.inc.php) , les exports , les réponses ajax et appeler les fonctions test_me dans les classes
(static function test_me() ).
Dans votre code, vous pouvez ajouter des portions de code ainsi
if (defined ('TEST_UNIT')) {
// exécuté uniquement si appelé pour les tests unitaires
}
-----------------------
ENGLISH
-----------------------
@ -55,5 +64,11 @@ You point you browser noalyss/html/test.php an you click on the link with the
and you can rerun the file , it works also for ajax.
It is useful to test ajax answer , unit test or testing a class
It is useful to test ajax answer , unit test or testing a class (with static function test_me() )
In your code, you can do
if (defined ('TEST_UNIT')) {
// executed only if calling script is test.php,
}

View file

@ -1,43 +0,0 @@
<?php
//@description:VEN Encodage d'une vente
$_GET=array (
'gDossier' => '42',
'ac' => 'COMPTA/VENMENU/VEN',
);
$_POST=array (
'ledger_type' => 'VEN',
'ac' => 'COMPTA/VENMENU/VEN',
'sa' => 'p',
'gDossier' => '42',
'nb_item' => '2',
'p_jrn' => '2',
'e_date' => '14.11.2016',
'e_ech' => '',
'e_client' => 'CLIENT1 ',
'e_pj' => 'VEN1',
'e_pj_suggest' => 'VEN1',
'e_comm' => 'Première vente',
'e_march0' => 'DEPLAC',
'e_march0_price' => '120',
'e_quant0' => '1',
'htva_march0' => '120',
'e_march0_tva_id' => '1',
'e_march0_tva_amount' => '25.2',
'tva_march0' => '25.2',
'tvac_march0' => '145.2',
'e_march1' => '',
'e_march1_price' => '',
'e_quant1' => '1',
'htva_march1' => '0',
'e_march1_tva_id' => '',
'e_march1_tva_amount' => '',
'tva_march1' => '0',
'tvac_march1' => '0',
'jrn_type' => 'VEN',
'e_mp' => '0',
'view_invoice' => 'Enregistrer',
);
$_POST['gDossier']=$gDossierLogInput;
$_GET['gDossier']=$gDossierLogInput;
$_REQUEST=array_merge($_GET,$_POST);
include 'compta_ven.inc.php';

View file

@ -1,40 +0,0 @@
<?php
//@description:VEN Enregistrement de la vente
$_GET=array (
'gDossier' => '42',
'ac' => 'COMPTA/VENMENU/VEN',
);
$_POST=array (
'gDossier' => '42',
'bon_comm' => '',
'other_info' => '',
'e_client' => 'CLIENT1 ',
'nb_item' => '2',
'p_jrn' => '2',
'mt' => '1415995185.7619',
'e_comm' => 'Première vente',
'e_date' => '14.11.2016',
'e_ech' => '',
'e_pj' => 'VEN1',
'e_pj_suggest' => 'VEN1',
'e_mp' => '0',
'jrn_type' => 'VEN',
'e_march0' => 'DEPLAC',
'e_march0_price' => '120',
'e_march0_tva_id' => '1',
'e_march0_tva_amount' => '25.2',
'e_quant0' => '1',
'e_march1' => '',
'e_march1_price' => '',
'e_march1_tva_id' => '',
'e_march1_tva_amount' => '',
'e_quant1' => '1',
'ac' => 'COMPTA/VENMENU/VEN',
'opd_name' => '',
'od_description' => '',
'record' => 'Enregistrement',
);
$_POST['gDossier']=$gDossierLogInput;
$_GET['gDossier']=$gDossierLogInput;
$_REQUEST=array_merge($_GET,$_POST);
include 'compta_ven.inc.php';