noalyss Version-9
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
test.php File Reference

this file let you debug and test the different functionnalities, there are 2 important things to do It is only a quick and dirty testing. You should use a tool as PHPUNIT for the unit testing More...

Go to the source code of this file.

Functions

 get_card_with_activity ()
 Return the card this most activities.
 

Variables

global $cn =Dossier::connect()
 
 $cnt_scenario =0
 
 $description =$http->get("description","string", "aucune description")
 
 $end_mem =memory_get_usage()
 
 $end_time =microtime(true)
 
global $g_failed
 
 $g_parameter =new Noalyss_Parameter_Folder($cn)
 
global $g_succeed
 
global $g_user =new Noalyss_user($cn)
 
 $gDossier =$http->request('gDossier',"number", -1)
 
if($gDossier==-1) $gDossierLogInput =$gDossier
 
global $http =new HttpInput()
 
 $max =$cn->get_value("select p_id from parm_periode order by p_start desc limit 1")
 
 $maxscan =count($scan)
 
 $min =$cn->get_value("select p_id from parm_periode order by p_start asc limit 1")
 
 $scan =scandir('../scenario/')
 
 $scenario =array()
 
for($e_scan=0; $e_scan< $maxscan; $e_scan++) $script =$http->request('script', "string",'')
 
 $start_time =microtime(true)
 
const ALLOWED (!file_exists('authorized_debug')) 1
 
if( $script=="") else if($script=='all') else
 

Detailed Description

this file let you debug and test the different functionnalities, there are 2 important things to do It is only a quick and dirty testing. You should use a tool as PHPUNIT for the unit testing

  • first do not forget to create the authorized_debug file in the html folder
  • secund the test must be adapted to this page : if you do a post (or get) from a test, you won't get any result if the $_REQUEST[test_select] is not set, so set it .

Definition in file test.php.

Function Documentation

◆ get_card_with_activity()

get_card_with_activity ( )

Return the card this most activities.

Returns
integer (fiche.f_id)

Definition at line 92 of file test.php.

92 {
93 global $cn;
94 $card_count=$cn->get_array("select count(*),f_id ".
95 " from jrnx ".
96 " where ".
97 " f_id is not null ".
98 "group by f_id order by count(*) desc");
99 return $card_count[0]['f_id'];
100}
101
102/*
103 * Loading of all scenario
104 */
105$scan=scandir('../scenario/');
106$maxscan=count($scan);
107$cnt_scenario=0;$scenario=array();
108
109for ($e_scan=0; $e_scan<$maxscan; $e_scan++)
110 {
111 if (is_file('../scenario/'.$scan[$e_scan])&&strpos($scan[$e_scan], '.php')==true)
112 {
113 $description="";
114 $a_description=file('../scenario/'.$scan[$e_scan]);
115 $max_description=count($a_description);
116 for ($w=0; $w<$max_description; $w++)
117 {
118 if (strpos($a_description[$w], '@description:')==true)
119 {
120 $description=$a_description[$w];
121 $description=noalyss_str_replace('//@description:', '', $description);
122 }
123 }
124 $scenario[$cnt_scenario]['file']=$scan[$e_scan];
127
128
129 }
130 }
131$script=$http->request('script', "string",'');
132$min=$cn->get_value("select p_id from parm_periode order by p_start asc limit 1");
133$max=$cn->get_value("select p_id from parm_periode order by p_start desc limit 1");
134printf ("Max période %s Min période %s",$max,$min);
135
136if ($script=="")
137{
138 echo "<h1>Test NOALYSS</h1>";
139 /*
140 * cherche pour fichier a include, s'il y en a alors les affiche
141 * avec une description
142 */
143
144
145 echo '<table>';
146 $get='test.php?'.http_build_query(array('script'=>"all", 'gDossier'=>$gDossierLogInput, 'description'=>"Tous les scripts"));
147 echo '<tr>';
148 echo '<td>';
149 echo '<a href="'.$get.'" target="_blank">';
150 echo "Tous ";
151 echo '</a>';
152 echo '</td>';
153 echo '<td>Tous les scripts</td>';
154 echo '</tr>';
155
156 for ($e=0; $e<$cnt_scenario; $e++)
157 {
158
159 $get='test.php?'.http_build_query(array('script'=>$scenario[$e]['file'], 'gDossier'=>$gDossierLogInput, 'description'=>$scenario[$e]['desc']));
160 echo '<tr>';
161 echo '<td>';
162 echo $e;
163 echo '</td>';
164 echo '<td>';
165 echo '<a href="'.$get.'" target="_blank">';
166 echo $scenario[$e]['file'];
167 echo '</a>';
168 echo '</td>';
169 echo '<td>'.$scenario[$e]['desc'].'</td>';
170 echo '</tr>';
171
172 }
173 echo '</table>';
174}
175else if ($script=='all')
176{
177 $nb=$http->get('nb_script', "number",0);
178
179 $start_mem=memory_get_usage();
180 $start_time=microtime(true);
182
183 echo '<h1>'.$nb." ".$scenario[$nb]['file']."</h1>";
184 echo '<h2> description = '.$scenario[$nb]["desc"].'</h2>';
185 include '../scenario/'.$scenario[$nb]['file'];
186 echo '</div>';
187 echo '</div>';
188 $end_mem=memory_get_usage();
189 $end_time=microtime(true);
190
191 echo "<p>start mem : ".$start_mem;
192 echo '</p>';
193 echo "<p>end mem : ".$end_mem;
194 echo '</p>';
195 echo "<p>Diff = ".($end_mem-$start_mem)." bytes ";
196 echo "<p>Diff = ".(round(($end_mem-$start_mem)/1024, 2))." kbytes ";
197 echo "<p>Diff = ".(round(($end_mem-$start_mem)/1024/1024, 2))." Mbytes ";
198 echo '</p>';
199 echo "<p>Execution script ".$script." time = ".(round(($end_time-$start_time), 4))." secondes</p>";
200 $nb++;
201 if ( $nb == $maxscan ) {
202 echo "Dernier test";
203 } else {
204 $get='test.php?'.http_build_query(array('script'=>"all", 'gDossier'=>$gDossierLogInput, 'nb_script'=>$nb));
205 echo '<a href="'.$get.'" target="_blank">';
206 echo $scenario[$nb]['file'];
207 }
208}
noalyss_str_replace($search, $replace, $string)
if($gDossier==-1) $gDossierLogInput
Definition ajax_test.php:47
foreach($array as $idx=> $m) $w
$script
Definition popup.php:125
$end_mem
Definition test.php:219
$scan
Definition test.php:105
$maxscan
Definition test.php:106
$end_time
Definition test.php:220
$start_time
Definition test.php:212
$scenario
Definition test.php:107
$cnt_scenario
Definition test.php:107

References $cn.

Variable Documentation

◆ $cn

$cn =Dossier::connect()

Definition at line 54 of file test.php.

◆ $cnt_scenario

$cnt_scenario =0

Definition at line 107 of file test.php.

◆ $description

$description =$http->get("description","string", "aucune description")

Definition at line 214 of file test.php.

◆ $end_mem

$end_mem =memory_get_usage()

Definition at line 219 of file test.php.

◆ $end_time

$end_time =microtime(true)

Definition at line 220 of file test.php.

◆ $g_failed

global $g_failed

Definition at line 54 of file test.php.

◆ $g_parameter

$g_parameter =new Noalyss_Parameter_Folder($cn)

Definition at line 57 of file test.php.

◆ $g_succeed

global $g_succeed

Definition at line 54 of file test.php.

◆ $g_user

$g_user =new Noalyss_user($cn)

Definition at line 54 of file test.php.

◆ $gDossier

$gDossier =$http->request('gDossier',"number", -1)

Definition at line 47 of file test.php.

◆ $gDossierLogInput

if ( $gDossier==-1) $gDossierLogInput =$gDossier

Definition at line 53 of file test.php.

◆ $http

$http =new HttpInput()

Definition at line 42 of file test.php.

◆ $max

$max =$cn->get_value("select p_id from parm_periode order by p_start desc limit 1")

Definition at line 133 of file test.php.

◆ $maxscan

$maxscan =count($scan)

Definition at line 106 of file test.php.

◆ $min

$min =$cn->get_value("select p_id from parm_periode order by p_start asc limit 1")

Definition at line 132 of file test.php.

◆ $scan

$scan =scandir('../scenario/')

Definition at line 105 of file test.php.

◆ $scenario

$scenario =array()

Definition at line 107 of file test.php.

◆ $script

$script ( ) =$http->request('script', "string",'')

Definition at line 131 of file test.php.

◆ $start_time

$start_time =microtime(true)

Definition at line 212 of file test.php.

◆ ALLOWED

const ALLOWED(!file_exists( 'authorized_debug')) ( ! file_exists 'authorized_debug') 1

Definition at line 66 of file test.php.

◆ else

if($script=="") else if ( $script=='all') else
Initial value:
{
$start_mem=memory_get_usage()

Definition at line 209 of file test.php.