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

@ -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;
}
}