Improve Test and set the Patch level to 181

This commit is contained in:
sparkyx 2022-11-20 21:23:36 +01:00
parent 0a37212d2a
commit 6bd4f72178
5 changed files with 38 additions and 15 deletions

View file

@ -121,8 +121,8 @@ class Fiche_Def
array($this->id));
*/
$sql="select * from fiche_def ".
" where fd_id=".$this->id;
$Ret=$this->cn->exec_sql($sql);
" where fd_id= $1";
$Ret=$this->cn->exec_sql($sql,[$this->id]);
if ( ($Max=Database::num_row($Ret)) == 0 )
return ;
$row=Database::fetch_array($Ret,0);
@ -133,8 +133,7 @@ class Fiche_Def
$this->fd_description=$row['fd_description'];
}
/*!
**************************************************
* \brief Get all the fiche_def
* \brief Get all the fiche_def
*
* \return an array of fiche_def object
*/
@ -144,17 +143,18 @@ class Fiche_Def
$Ret=$this->cn->exec_sql($sql);
if ( ($Max=Database::num_row($Ret)) == 0 )
return ;
return array();
$all=array();
for ( $i = 0; $i < $Max;$i++)
{
$row=Database::fetch_array($Ret,$i);
$this->all[$i]=new Fiche_Def($this->cn,$row['fd_id']);
$this->all[$i]->label=$row['fd_label'];
$this->all[$i]->class_base=$row['fd_class_base'];
$this->all[$i]->fiche_def=$row['frd_id'];
$this->all[$i]->create_account=$row['fd_create_account'];
$all[$i]=new Fiche_Def($this->cn,$row['fd_id']);
$all[$i]->label=$row['fd_label'];
$all[$i]->class_base=$row['fd_class_base'];
$all[$i]->fiche_def=$row['frd_id'];
$all[$i]->create_account=$row['fd_create_account'];
}
return $all;
}
/*!
**************************************************
@ -196,7 +196,8 @@ $order
require_once NOALYSS_TEMPLATE.'/fiche_def_list.php';
}
/*!\brief Add a fiche category thanks the element from the array
/*!
* \brief Add a fiche category thanks the element from the array
* you cannot add twice the same cat. name
* table : insert into fiche_def
* insert into attr_def

View file

@ -116,7 +116,7 @@ if (!defined("NOALYSS_PACKAGE_REPOSITORY")) {
if (!defined("SYSINFO_DISPLAY")) {
define("SYSINFO_DISPLAY", TRUE);
}
define("DBVERSION", 180);
define("DBVERSION", 181);
define("MONO_DATABASE", 25);
define("DBVERSIONREPO", 20);
define('NOTFOUND', '--not found--');

View file

@ -198,4 +198,26 @@ class Fiche_DefTest extends Testcase
$fiche_def->RemoveAttribut([20, 21, 22, 51, 52, 53]);
}
/**
@testdox get a Fiche_Def
*/
function testGet()
{
global $g_connection;
$fiche_def=$this->getFicheDef();
$fiche_def->get();
$this->assertTrue($fiche_def->label=='Test.card',"Can not retrieve label");
}
/**
@testdox get all Fiche_Def
*/
function testGetAll()
{
global $g_connection;
$fiche_def=$this->getFicheDef();
$all=$fiche_def->get_all();
$this->assertEquals(count($all) , 8 ,"Retrieve an wrong number of Fiche_Def");
}
}

View file

@ -180,7 +180,7 @@ class ContactTest extends TestCase
$filename="contact-summary-1.html";
\Noalyss\Facility::save_file($path,$filename,$r);
print "File saved into $path/$filename";
$this->assertEquals(4988, filesize ($path."/".$filename)," File not valide (1)");
$this->assertEquals(4988, filesize ($path."/".$filename)," File not valide (1) $filename");
$this->assertEquals(5 , preg_match_all('/<tr class="/',$r)," 1. Missing card");
$contact->filter_company(' fourni ');
ob_start();

View file

@ -1,4 +1,4 @@
2<?php
<?php
use PHPUnit\Framework\TestCase;