diff --git a/htdocs/core/class/html.formcontract.class.php b/htdocs/core/class/html.formcontract.class.php
index fc869901f01..954f0b6ea75 100644
--- a/htdocs/core/class/html.formcontract.class.php
+++ b/htdocs/core/class/html.formcontract.class.php
@@ -61,7 +61,7 @@ class FormContract
* @param int $showRef Show customer and supplier reference on each contract (when found)
* @param int $noouput 1=Return the output instead of display
* @param string $morecss More CSS
- * @return int Nbr of contract if OK, <0 if KO
+ * @return int|string If nooutput = 0: Nbr of contract if OK, <0 if KO, If nooutput = 1: The HTML select string
*/
public function select_contract($socid = -1, $selected = 0, $htmlname = 'contrattid', $maxlength = 16, $showempty = 1, $showRef = 0, $noouput = 0, $morecss = 'minwidth150')
{
diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php
index 00ba4fa8532..fe44a813231 100644
--- a/htdocs/fourn/class/api_supplier_invoices.class.php
+++ b/htdocs/fourn/class/api_supplier_invoices.class.php
@@ -474,7 +474,7 @@ class SupplierInvoices extends DolibarrApi
$paiement->amounts = $amounts; // Array with all payments dispatching with invoice id
$paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching
$paiement->paiementid = $payment_mode_id;
- $paiement->paiementcode = dol_getIdFromCode($this->db, $payment_mode_id, 'c_paiement', 'id', 'code', 1);
+ $paiement->paiementcode = (string) dol_getIdFromCode($this->db, $payment_mode_id, 'c_paiement', 'id', 'code', 1);
$paiement->num_payment = $num_payment;
$paiement->note_public = $comment;
@@ -704,7 +704,12 @@ class SupplierInvoices extends DolibarrApi
$updateRes = $this->invoice->deleteLine($lineid);
if ($updateRes > 0) {
- return $this->get($id);
+ return array(
+ 'success' => array(
+ 'code' => 200,
+ 'message' => 'line '.$lineid.' deleted'
+ )
+ );
} else {
throw new RestException(405, $this->invoice->error);
}
diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php
index 8a85a32e37a..820c92baa11 100644
--- a/htdocs/fourn/class/fournisseur.facture-rec.class.php
+++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php
@@ -1249,7 +1249,7 @@ class FactureFournisseurRec extends CommonInvoice
* Format string to output with by striking the string if max number of generation was reached
*
* @param string $ret Default value to output
- * @return boolean False by default, True if maximum number of generation is reached
+ * @return string False by default, True if maximum number of generation is reached
*/
public function strikeIfMaxNbGenReached($ret)
{
diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php
index cb36f12fe4f..4f1c81602a1 100644
--- a/htdocs/fourn/facture/paiement.php
+++ b/htdocs/fourn/facture/paiement.php
@@ -311,7 +311,13 @@ if (empty($reshook)) {
// Creation of payment line
$paiement = new PaiementFourn($db);
$paiement->datepaye = $datepaye;
- $paiement->amounts = $amounts; // Array of amounts
+
+ $correctedAmounts = [];
+ foreach ($amounts as $key => $value) {
+ $correctedAmounts[$key] = (float) $value;
+ }
+
+ $paiement->amounts = $correctedAmounts; // Array of amounts
$paiement->multicurrency_amounts = $multicurrency_amounts;
$paiement->multicurrency_code = $multicurrency_code; // Array with all currency of payments dispatching
$paiement->multicurrency_tx = $multicurrency_tx; // Array with all currency tx of payments dispatching
diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php
index 6163ae449b2..28e87fc428f 100644
--- a/htdocs/ticket/class/api_tickets.class.php
+++ b/htdocs/ticket/class/api_tickets.class.php
@@ -382,11 +382,11 @@ class Tickets extends DolibarrApi
$this->ticket->$field = $value;
}
- if ($this->ticket->update(DolibarrApiAccess::$user)) {
+ if ($this->ticket->update(DolibarrApiAccess::$user) > 0) {
return $this->get($id);
+ } else {
+ throw new RestException(500, $this->ticket->error);
}
-
- return false;
}
/**
diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php
index b7fb7ec2c6b..f22db99fd9c 100644
--- a/htdocs/website/class/website.class.php
+++ b/htdocs/website/class/website.class.php
@@ -923,7 +923,7 @@ class Website extends CommonObject
$this->lang = 'en';
$this->otherlang = 'fr,es';
$this->status = 1;
- $this->fk_default_home = null;
+ $this->fk_default_home = 0;
$this->virtualhost = 'http://myvirtualhost';
$this->fk_user_creat = $user->id;
$this->fk_user_modif = $user->id;
diff --git a/test/phpunit/CommonClassTest.class.php b/test/phpunit/CommonClassTest.class.php
index 0e5f49dd24b..0322cdd28bc 100644
--- a/test/phpunit/CommonClassTest.class.php
+++ b/test/phpunit/CommonClassTest.class.php
@@ -116,11 +116,7 @@ abstract class CommonClassTest extends TestCase
if ($t instanceof PHPUnit\Framework\Error\Notice) {
$nbLinesToShow = 3;
}
- $totalLines = count($lines);
- $first_line = max(0, $totalLines - $nbLinesToShow);
- // Get the last line of the log
- $last_lines = array_slice($lines, $first_line, $nbLinesToShow);
$failedTestMethod = $this->getName(false);
$className = get_called_class();
@@ -131,14 +127,25 @@ abstract class CommonClassTest extends TestCase
// Get the test method's data set
$argsText = $this->getDataSetAsString(true);
- // Show log file
+ $totalLines = count($lines);
+ $first_line = max(0, $totalLines - $nbLinesToShow);
+ // Get the last line of the log
+ $last_lines = array_slice($lines, $first_line, $nbLinesToShow);
+
print PHP_EOL;
- print "----- $className::$failedTestMethod failed - $argsText.".PHP_EOL;
- print "Show last ".$nbLinesToShow." lines of dolibarr.log file -----".PHP_EOL;
- foreach ($last_lines as $line) {
- print $line.PHP_EOL;
+ // Use GitHub Action compatible group output (:warning: arguments not encoded)
+ print "##[group]$className::$failedTestMethod failed - $argsText.".PHP_EOL;
+ print "## Exception: {$t->getMessage()}".PHP_EOL;
+
+ if ($nbLinesToShow) {
+ // Show partial log file contents when requested.
+ print "## Show last ".$nbLinesToShow." lines of dolibarr.log file -----".PHP_EOL;
+ foreach ($last_lines as $line) {
+ print $line.PHP_EOL;
+ }
+ print "## end of dolibarr.log for $className::$failedTestMethod".PHP_EOL;
}
- print "----- end of dolibarr.log for $className::$failedTestMethod".PHP_EOL;
+ print "##[endgroup]".PHP_EOL;
parent::onNotSuccessfulTest($t);
}
@@ -359,4 +366,24 @@ abstract class CommonClassTest extends TestCase
$this->assertDirectoryDoesNotExist($directory, $message);
}
}
+
+ /**
+ * Assert that a file does not exist without triggering deprecation
+ *
+ * @param string $file The file to test
+ * @param string $message The message to show if the directory exists
+ *
+ * @return void
+ */
+ protected function assertFileNotExistsCompat($file, $message = '')
+ {
+ $phpunitVersion = \PHPUnit\Runner\Version::id();
+
+ // Check if PHPUnit version is less than 9.0.0
+ if (version_compare($phpunitVersion, '9.0.0', '<')) {
+ $this->assertFileNotExists($file, $message);
+ } else {
+ $this->assertFileDoesNotExist($file, $message);
+ }
+ }
}