From 4d4638c75a4a5ecb7bbc805ddcc1632df40f0bf9 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 15 Jan 2025 12:09:49 +0100 Subject: [PATCH 1/4] FIX avoid php warning --- htdocs/user/card.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index c09ae7c6985..0f6bb9bc430 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -130,6 +130,9 @@ if ($user->id != $id && !$canreaduser) { accessforbidden(); } +$caneditpasswordandsee = $canadduser; +$caneditpasswordandsend = $canadduser; + // Define value to know what current user can do on properties of edited user if ($id > 0) { // $user is the current logged user, $id is the user we want to edit From 0a45c4cad21c9a4d1dd4f28ba4cc3a7666c98111 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Jan 2025 14:16:11 +0100 Subject: [PATCH 2/4] Update card.php --- htdocs/user/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 0f6bb9bc430..264fa0f0647 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -130,8 +130,8 @@ if ($user->id != $id && !$canreaduser) { accessforbidden(); } -$caneditpasswordandsee = $canadduser; -$caneditpasswordandsend = $canadduser; +$caneditpasswordandsee = false; +$caneditpasswordandsend = false; // Define value to know what current user can do on properties of edited user if ($id > 0) { From 311a6bf0a9d4997f7f82e788125d568adf51ea78 Mon Sep 17 00:00:00 2001 From: MDW Date: Fri, 17 Jan 2025 00:31:18 +0100 Subject: [PATCH 3/4] Fix ci: travis - Better test if phpunit completed # Fix ci: travis - Better test if phpunit completed --- .travis.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7129c93d9f1..0020c7b067b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -528,12 +528,11 @@ script: - | echo "Unit testing" - # Ensure we catch errors with -e. Set this to +e instead of -e if you want to go to the end to see dolibarr.log file. - set -e - phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php - phpunitresult=$? + # Execute phpunit, check its exit status and that the phpunit output shows a test summary + phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php | tee /dev/tty | grep -qE "(OK .*[0-9]+ tests.*[0-9]+ assertions|Tests: [0-9]+)" ; phpunitresult=$((PIPESTATUS[0]?PIPESTATUS[0]:PIPESTATUS[2])) echo "Phpunit return code = $phpunitresult" - set +e + # Comment next line if you want to go to the end to see the dolibarr.log file. + [ $phpunitresult == 0 ] || exit $phpunitresult echo after_script: From 490750e810b03b517aeb2c5650c8dedc4f712363 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 16 Jan 2025 17:23:13 +0100 Subject: [PATCH 4/4] Qual: Remove var_dump and exit from SocieteTest --- test/phpunit/SocieteTest.php | 40 +++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/test/phpunit/SocieteTest.php b/test/phpunit/SocieteTest.php index cd82b4155d3..4ca93839881 100644 --- a/test/phpunit/SocieteTest.php +++ b/test/phpunit/SocieteTest.php @@ -1,6 +1,9 @@ * Copyright (C) 2023 Alexandre Janniaux + * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,9 +47,9 @@ $conf->global->MAIN_DISABLE_ALL_MAILS = 1; /** * Class for PHPUnit tests * - * @backupGlobals disabled + * @backupGlobals disabled * @backupStaticAttributes enabled - * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. + * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ class SocieteTest extends CommonClassTest { @@ -74,7 +77,7 @@ class SocieteTest extends CommonClassTest die(1); } - $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. print __METHOD__."\n"; } @@ -99,7 +102,6 @@ class SocieteTest extends CommonClassTest $localobject->country_code = 'ES'; $result = $localobject->create($user); - var_dump($localobject);exit; print __METHOD__." result=".$result."\n"; $this->assertLessThanOrEqual($result, 0); @@ -110,10 +112,10 @@ class SocieteTest extends CommonClassTest /** * testSocieteFetch * - * @param int $id Company id - * @return Societe $localobject Company + * @param int $id Company id + * @return Societe $localobject Company * - * @depends testSocieteCreate + * @depends testSocieteCreate * The depends says test is run only if previous is ok */ public function testSocieteFetch($id) @@ -139,9 +141,9 @@ class SocieteTest extends CommonClassTest /** * testSocieteUpdate * - * @param Societe $localobject Company - * @return Societe $localobject Company - * + * @param Societe $localobject Company + * @return Societe $localobject Company + * * @depends testSocieteFetch * The depends says test is run only if previous is ok */ @@ -211,8 +213,8 @@ class SocieteTest extends CommonClassTest /** * testIdProfCheck * - * @param Societe $localobject Company - * @return Societe $localobject Company + * @param Societe $localobject Company + * @return Societe $localobject Company * * @depends testSocieteUpdate * The depends says test is run only if previous is ok @@ -266,8 +268,8 @@ class SocieteTest extends CommonClassTest /** * testSocieteOther * - * @param Societe $localobject Company - * @return int $id Id of company + * @param Societe $localobject Company + * @return int $id Id of company * * @depends testIdProfCheck * The depends says test is run only if previous is ok @@ -326,8 +328,8 @@ class SocieteTest extends CommonClassTest /** * testGetOutstandingBills * - * @param int $id Id of company - * @return int + * @param int $id Id of company + * @return int * * @depends testSocieteOther * The depends says test is run only if previous is ok @@ -355,8 +357,8 @@ class SocieteTest extends CommonClassTest /** * testSocieteDelete * - * @param int $id Id of company - * @return int + * @param int $id Id of company + * @return int * * @depends testGetOutstandingBills * The depends says test is run only if previous is ok @@ -383,7 +385,7 @@ class SocieteTest extends CommonClassTest /** * testSocieteGetFullAddress * - * @return int $id Id of company + * @return int $id Id of company */ public function testSocieteGetFullAddress() {