PHPUNIT : adapt 12.3

This commit is contained in:
sparkyx 2025-09-15 22:50:03 +02:00
parent 9ebb89b38a
commit 8dca7f0866
32 changed files with 123 additions and 345 deletions

View file

@ -1,7 +1,7 @@
<?php
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Attributes\DataProvider;
/**
* Generated by PHPUnit_SkeletonGenerator on 2014-11-07 at 23:05:36.
* @backupGlobals enabled
@ -16,12 +16,7 @@ class FicheTest extends TestCase
*/
protected $object;
private $g_connection;
function __construct($name = null, array $data = [], $dataName = '')
{
parent::__construct($name, $data, $dataName);
}
/**
* Sets up the fixture, for example, opens a network connection.
@ -311,7 +306,7 @@ class FicheTest extends TestCase
$this->assertEquals($nb_fiche, $nb_fiche_after, 'card not removed');
}
public function dataEmptyQuickCode()
public static function dataEmptyQuickCode()
{
return array(
array("none", ""),
@ -328,6 +323,7 @@ class FicheTest extends TestCase
* @testdox testInsertEmptyQuickCode Test if it is possible to insert an empty quickcode
* @dataProvider dataEmptyQuickCode
*/
#[DataProvider('dataEmptyQuickCode')]
public function testInsertEmptyQuickCode($name, $quick_code)
{
//insert
@ -338,7 +334,7 @@ class FicheTest extends TestCase
$fiche->remove();
}
function dataUpdateQuickCode()
static function dataUpdateQuickCode()
{
return array(
array('a+z+1-5', 'AZ1-5'),
@ -358,6 +354,7 @@ class FicheTest extends TestCase
* @testdox testUpdateEmptyQuickCode Test if it is possible to update an empty quickcode
* @dataProvider dataUpdateQuickCode
*/
#[DataProvider('dataUpdateQuickCode')]
public function testUpdateEmptyQuickCode($name, $quick_code)
{
$aCardId=[];
@ -439,7 +436,7 @@ where
}
}
function dataFormat_QuickCode()
static function dataFormat_QuickCode()
{
return array(
array('a+z+1-5','AZ1-5'),
@ -458,12 +455,13 @@ where
* @testdox test comptaproc.format_quickcode
* @dataProvider dataFormat_Quickcode
*/
#[DataProvider('dataFormat_Quickcode')]
public function testFormat_QuickCode($p_qcode,$p_result)
{
$this->assertEquals($p_result,$this->g_connection->get_value( "select comptaproc.format_quickcode($1)",
[$p_result]),'quickcode is not transformed correctly');
}
function dataInsertName()
static function dataInsertName()
{
return array(
['',"Nom vide"],
@ -475,6 +473,7 @@ where
* @testdox Test if it is possible to insert an empty name
* @dataProvider dataInsertName
*/
#[DataProvider('dataInsertName')]
public function testInsertName($p_name,$p_result)
{
@ -490,6 +489,7 @@ where
* @testdox Test if it is possible to insert or update a empty name
* @dataProvider dataInsertName
*/
#[DataProvider('dataInsertName')]
public function testUpdateName($p_name,$p_result)
{
@ -613,7 +613,7 @@ where
$this->assertEquals($i,$fiche->get_attribute(ATTR_DEF_ACCOUNT),'Account not properly created');
}
}
public function dataAccount()
public static function dataAccount()
{
return array(
['600002','600002'],
@ -626,6 +626,7 @@ where
* @testdox testAccountInsert Set of the accounting while inserting, numeric with automatic
* @dataProvider dataAccount
*/
#[DataProvider('dataAccount')]
public function testAccountInsert($p_value,$p_expected)
{
$fiche=$this->build_fiche(2, 'PHPUNIT.ACCOUNT.INSERT');
@ -697,6 +698,7 @@ where
* @testdox testAccountUpdate et of the accounting while updating
* @dataProvider dataAccount
*/
#[DataProvider('dataAccount')]
public function testAccountUpdate($p_value,$p_expected)
{
$this->g_connection->exec_sql("update public.parameter set pr_value = $1 where pr_id=$2",