noalyss  Version-9
Functions | Variables
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. More...
 

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 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

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 76 of file test.php.

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

References $cn.

Variable Documentation

◆ $cn

Definition at line 54 of file test.php.

Referenced by get_card_with_activity().

◆ $cnt_scenario

$cnt_scenario =0

Definition at line 91 of file test.php.

◆ $description

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

Definition at line 198 of file test.php.

◆ $end_mem

$end_mem =memory_get_usage()

Definition at line 203 of file test.php.

◆ $end_time

$end_time =microtime(true)

Definition at line 204 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 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 117 of file test.php.

◆ $maxscan

$maxscan =count($scan)

Definition at line 90 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 116 of file test.php.

◆ $scan

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

Definition at line 89 of file test.php.

◆ $scenario

$scenario =array()

Definition at line 91 of file test.php.

◆ $script

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

Definition at line 115 of file test.php.

◆ $start_time

$start_time =microtime(true)

Definition at line 196 of file test.php.

◆ ALLOWED

const ALLOWED(!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 194 of file test.php.

$w
foreach($array as $idx=> $m) $w
Definition: anc_group.inc.php:69
$e
$e
Definition: result_cat_card_summary.php:26
$gDossierLogInput
if($gDossier==-1) $gDossierLogInput
Definition: test.php:53
$end_time
$end_time
Definition: test.php:204
$http
global $http
Definition: test.php:42
$cnt_scenario
$cnt_scenario
Definition: test.php:91
$end_mem
$end_mem
Definition: test.php:203
$min
$min
Definition: test.php:116
$scenario
$scenario
Definition: test.php:91
$scan
$scan
Definition: test.php:89
$max
$max
Definition: test.php:117
$maxscan
$maxscan
Definition: test.php:90
$description
$description
Definition: test.php:198
$cn
global $cn
Definition: test.php:54
$nb
$nb
Definition: ajax_auto_anc_card.php:32
$start_time
$start_time
Definition: test.php:196
$script
for($e_scan=0; $e_scan< $maxscan; $e_scan++) $script
Definition: test.php:115