Fix PHPUNIT for PHP8.2

This commit is contained in:
sparkyx 2025-09-03 00:04:05 +02:00
parent 6a8c1dd259
commit 70d56be03f
20 changed files with 62 additions and 23 deletions

View file

@ -39,7 +39,7 @@ abstract class Acc_Ledger_History
public $db; //!< database connx
protected $ledger_type; //! type of ledger VEN , ACH , ODS, FIN
protected $filter_operation; //!< to filter paid, unpaid or all operation
protected $data;//!< array of rows
/**
*
* @param Database $cn

View file

@ -33,7 +33,6 @@
class Acc_Ledger_History_Generic extends Acc_Ledger_History
{
private $data; //!< array of rows
/**
* Constructor

View file

@ -32,7 +32,6 @@
class Acc_Ledger_History_Purchase extends Acc_Ledger_History
{
private $data;//!< Contains rows from SQL
/**
* @param mixed $data

View file

@ -32,8 +32,7 @@
class Acc_Ledger_History_Sale extends Acc_Ledger_History
{
private $data; //!< Contains rows from SQL
public function __construct(\Database $cn, $pa_ledger, $p_from, $p_to,
$p_mode)

View file

@ -30,10 +30,23 @@
*/
class Print_Ledger extends PDF
{
protected $filter_operation; // See Acc_Ledger_History::filter_operation
protected $filter_operation; //!< See Acc_Ledger_History::filter_operation
private $ledger ; //!< concerned Ledger
private $from ; //! integer parm_periode.p_id , start periode;
private $to ; //! integer parm_periode.p_id , end periode;
protected $a_TVA; //!< array of VAT
protected $rap_tva; //!< VAT when page starts
protected $rap_other; //!< VAT when page starts
protected $jrn_type; //!< ledger type (VEN, ODS, FIN,ACH)
protected $previous; //!< previous amount
protected $other_tax_previous;
protected $rap_htva; //!< price without when page starts
protected $rap_tvac; //!< VAT+price when page starts
protected $rap_priv;//!< Private when page starts
protected $rap_nd;//!< ND VAT when page starts
protected $rap_tva_np;//!< NP VAT when page starts
protected $flag_other_tax; //! if other tax
protected $show_col;
public function __construct(\Database $p_cn,
$orientation,
$unit,

View file

@ -32,6 +32,10 @@
class Print_Ledger_Simple_Without_Vat extends Print_Ledger
{
protected $tp_priv;
protected $tp_htva;
protected $tp_tvac;
protected $tp_nd;
public function __construct ($p_cn,$p_jrn,$p_from,$p_to,$p_filter_operation)
{

View file

@ -27,8 +27,8 @@ global $g_connection,$g_parameter,$g_user;
if (!defined("DOSSIER"))define ("DOSSIER",25);
$_REQUEST['gDossier'] = DOSSIER;
$g_connection=new Database(DOSSIER);
$g_parameter = new Noalyss_Parameter_Folder($g_connection);
$g_connection=new \Database(DOSSIER);
$g_parameter = new \Noalyss_Parameter_Folder($g_connection);
$_SESSION[SESSION_KEY.'use_name']='unit test';
$_SESSION[SESSION_KEY.'use_first_name']='automatic';
$_SESSION[SESSION_KEY.'g_user']='admin';

View file

@ -163,7 +163,6 @@ class AccountRepositoryTest extends TestCase {
$db->close();
$this->assertEquals(11, $nb_table, " number of table incorrect $nb_table");
} catch (\Exception $ex) {
$db->close();
echo $ex->getMessage();
echo $ex->getTraceAsString();
$this->assertTrue(false, __CLASS__ . " cannot create DB");

View file

@ -194,6 +194,16 @@ class Acc_ComputeTest extends TestCase
public function testCompute()
{
print "**********************************************";
print PHP_EOL;
print "<h1> OUTPUT IN HTML , USE LYNX TO READ</h1>";
print PHP_EOL;
print " OR REDIRECT TO HTML";
print PHP_EOL;
print "**********************************************";
print PHP_EOL;
print "phpunit |lynx -stdin";
print PHP_EOL;
$a=new Acc_Compute();
// Compute some operation to see if the computed amount are
// correct

View file

@ -15,7 +15,7 @@ class Acc_Ledger_PurchaseTest extends TestCase
* @var Acc_Ledger_Purchase
*/
protected $object;
private $array1;
/**
* @var array transmitted by _POST
*/

View file

@ -19,6 +19,7 @@ class Acc_Ledger_SaleTest extends TestCase
* @var type
*/
private $array;
private $array1;
/**
* Sets up the fixture, for example, opens a network connection.

View file

@ -39,7 +39,7 @@ class Acc_Letter extends TestCase
* @var Fiche
*/
protected $object;
private $a_column;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test method is executed.

View file

@ -35,7 +35,7 @@ class Print_Ledger_DetailTest extends TestCase
* @var
*/
protected $object;
private $from,$to;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.

View file

@ -33,7 +33,7 @@ class Print_Ledger_Detail_ItemTest extends TestCase
* @var
*/
protected $object;
private $from,$to;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
@ -63,7 +63,7 @@ class Print_Ledger_Detail_ItemTest extends TestCase
// Purchase
//-------------------------------------------------------------------------------------------------------------
$ledger_purchase=new Acc_Ledger_Purchase($g_connection,3);
$ledger_purchase=new \Acc_Ledger_Purchase($g_connection,3);
// Paid
//------------

View file

@ -33,7 +33,7 @@ class Print_Ledger_FinTest extends TestCase
* @var
*/
protected $object;
private $from,$to;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
@ -72,7 +72,7 @@ class Print_Ledger_FinTest extends TestCase
$ledger->setTitle(_("Journal"), true);
$ledger->export();
$ledger->Output(__DIR__."/file/financial-detail.pdf","F");
print "create ".__DIR__."/file/financial-detail.pdf". PHP_EOL;
$ledger=\Print_Ledger::factory($g_connection,"L", $ledger_fin, $p_from, $p_to, "paid");
$this->assertTrue($ledger instanceof Print_Ledger_Financial
,"Fin. Detail returns Print_Ledger_Financial");
@ -83,7 +83,7 @@ class Print_Ledger_FinTest extends TestCase
$ledger->setTitle(_("Journal"), true);
$ledger->export();
$ledger->Output(__DIR__."/file/financial-listing.pdf","F");
print "create ".__DIR__."/file/financial-listing.pdf". PHP_EOL;
$ledger=\Print_Ledger::factory($g_connection,"E", $ledger_fin, $p_from, $p_to, "paid");
$this->assertTrue($ledger instanceof Print_Ledger_Detail
@ -95,6 +95,7 @@ class Print_Ledger_FinTest extends TestCase
$ledger->setTitle(_("Journal"), true);
$ledger->export();
$ledger->Output(__DIR__."/file/financial-extended.pdf","F");
print "create ".__DIR__."/file/financial-extended.pdf". PHP_EOL;
$ledger=\Print_Ledger::factory($g_connection,"A", $ledger_fin, $p_from, $p_to, "paid");
$this->assertTrue($ledger instanceof Print_Ledger_Detail
@ -106,6 +107,7 @@ class Print_Ledger_FinTest extends TestCase
$ledger->setTitle(_("Journal"), true);
$ledger->export();
$ledger->Output(__DIR__."/file/financial-accounting.pdf","F");
print "create ".__DIR__."/file/financial-accounting.pdf". PHP_EOL;
}
}

View file

@ -32,7 +32,7 @@ class Print_Ledger_MiscTest extends TestCase
* @var
*/
protected $object;
private $from,$to;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
@ -73,6 +73,7 @@ class Print_Ledger_MiscTest extends TestCase
$ledger->setTitle(_("Journal Opérations diverses "), true);
$ledger->export();
$ledger->Output(__DIR__."/file/print_ledger_detail_misc.pdf", "F");
print __DIR__."/file/print_ledger_detail_misc.pdf". PHP_EOL;
$ledger=\Print_Ledger::factory($g_connection, "L", $ledger_misc, $p_from, $p_to, "all");
$this->assertTrue($ledger instanceof Print_Ledger_Misc
@ -84,6 +85,7 @@ class Print_Ledger_MiscTest extends TestCase
$ledger->setTitle(_("Journal Opérations diverses"), true);
$ledger->export();
$ledger->Output(__DIR__."/file/print_ledger_misc.pdf", "F");
print __DIR__."/file/print_ledger_misc.pdf". PHP_EOL;
}
}

View file

@ -33,7 +33,7 @@ class print_ledger_simpleTest extends TestCase
* @var
*/
protected $object;
private $from,$to;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
@ -82,6 +82,7 @@ class print_ledger_simpleTest extends TestCase
$ledger->setTitle(_("Journal Achat Payé"), true);
$ledger->export();
$ledger->Output(__DIR__."/file/print_ledger_simple_purchase_paid.pdf", "F");
$this->assertFileExists(__DIR__."/file/print_ledger_simple_purchase_paid.pdf");
// Unpaid
//------------
@ -97,7 +98,7 @@ class print_ledger_simpleTest extends TestCase
$ledger->export();
$ledger->Output(__DIR__."/file/print_ledger_simple_purchase_unpaid.pdf", "F");
$this->assertFileExists(__DIR__."/file/print_ledger_simple_purchase_unpaid.pdf");
print __DIR__."/file/print_ledger_simple_purchase_unpaid.pdf".PHP_EOL;
// All
//------------
$ledger=\Print_Ledger::factory($g_connection, "E", $ledger_purchase, $p_from, $p_to, "all");
@ -112,7 +113,7 @@ class print_ledger_simpleTest extends TestCase
$ledger->export();
$ledger->Output(__DIR__."/file/print_ledger_simple_purchase_all.pdf", "F");
$this->assertFileExists(__DIR__."/file/print_ledger_simple_purchase_all.pdf");
print __DIR__."/file/print_ledger_simple_purchase_all.pdf".PHP_EOL;
//-------------------------------------------------------------------------------------------------------------
// Sale
//-------------------------------------------------------------------------------------------------------------
@ -131,6 +132,7 @@ class print_ledger_simpleTest extends TestCase
$ledger->setTitle(_("Journal Vente Payé"), true);
$ledger->export();
$ledger->Output(__DIR__."/file/print_ledger_simple_sale_paid.pdf", "F");
print __DIR__."/file/print_ledger_simple_sale_paid.pdf".PHP_EOL;
// Unpaid
//-----------------
@ -146,6 +148,7 @@ class print_ledger_simpleTest extends TestCase
$ledger->export();
$ledger->Output(__DIR__."/file/print_ledger_simple_sale_unpaid.pdf", "F");
$this->assertFileExists(__DIR__."/file/print_ledger_simple_sale_unpaid.pdf");
print __DIR__."/file/print_ledger_simple_sale_unpaid.pdf".PHP_EOL;
// All
//-----------------
@ -161,6 +164,8 @@ class print_ledger_simpleTest extends TestCase
$ledger->export();
$ledger->Output(__DIR__."/file/print_ledger_simple_sale_all.pdf", "F");
$this->assertFileExists(__DIR__."/file/print_ledger_simple_sale_all.pdf");
print __DIR__."/file/print_ledger_simple_sale_all.pdf".PHP_EOL;
}
}

View file

@ -33,7 +33,7 @@ class Print_Ledger_Simple_Without_VatTest extends TestCase
* @var
*/
protected $object;
private $from,$to;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
@ -82,7 +82,8 @@ class Print_Ledger_Simple_Without_VatTest extends TestCase
$ledger->setTitle(_("Journal Achat Payé"), true);
$ledger->export();
$ledger->Output(__DIR__."/file/print_Ledger_simple_without_vat_purchase_paid.pdf", "F");
$this->assertFileExists(__DIR__."/file/print_Ledger_simple_without_vat_purchase_paid.pdf", "F");
print __DIR__."/file/print_Ledger_simple_without_vat_purchase_paid.pdf".PHP_EOL;
// Unpaid
//------------
$ledger=new Print_Ledger_Simple_Without_Vat($g_connection,
@ -96,6 +97,7 @@ class Print_Ledger_Simple_Without_VatTest extends TestCase
$ledger->export();
$ledger->Output(__DIR__."/file/print_Ledger_simple_without_vat_purchase_unpaid.pdf", "F");
$this->assertFileExists(__DIR__."/file/print_Ledger_simple_without_vat_purchase_unpaid.pdf");
print __DIR__."/file/print_Ledger_simple_without_vat_purchase_unpaid.pdf".PHP_EOL;
// All
//------------
@ -110,6 +112,7 @@ class Print_Ledger_Simple_Without_VatTest extends TestCase
$ledger->export();
$ledger->Output(__DIR__."/file/print_Ledger_simple_without_vat_purchase_all.pdf", "F");
$this->assertFileExists(__DIR__."/file/print_Ledger_simple_without_vat_purchase_all.pdf");
print __DIR__."/file/print_Ledger_simple_without_vat_purchase_all.pdf".PHP_EOL;
//-------------------------------------------------------------------------------------------------------------
// Sale
@ -128,6 +131,7 @@ class Print_Ledger_Simple_Without_VatTest extends TestCase
$ledger->setTitle(_("Journal Vente Payé"), true);
$ledger->export();
$ledger->Output(__DIR__."/file/print_Ledger_simple_without_vat_sale_paid.pdf", "F");
print __DIR__."/file/print_Ledger_simple_without_vat_sale_paid.pdf".PHP_EOL;
// Unpaid
//-----------------
@ -142,6 +146,7 @@ class Print_Ledger_Simple_Without_VatTest extends TestCase
$ledger->export();
$ledger->Output(__DIR__."/file/print_Ledger_simple_without_vat_sale_unpaid.pdf", "F");
$this->assertFileExists(__DIR__."/file/print_Ledger_simple_without_vat_sale_unpaid.pdf");
print __DIR__."/file/print_Ledger_simple_without_vat_sale_unpaid.pdf".PHP_EOL;
// All
//-----------------
@ -156,6 +161,7 @@ class Print_Ledger_Simple_Without_VatTest extends TestCase
$ledger->export();
$ledger->Output(__DIR__."/file/print_Ledger_simple_without_vat_sale_all.pdf", "F");
$this->assertFileExists(__DIR__."/file/print_Ledger_simple_without_vat_sale_all.pdf");
print __DIR__."/file/print_Ledger_simple_without_vat_sale_all.pdf".PHP_EOL;
}
}