From 4e5e5542ffaa4f09b6c2218d448c672da6027168 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Aug 2019 14:27:02 +0200 Subject: [PATCH] Fix can run ws test several times --- test/phpunit/WebservicesInvoicesTest.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/phpunit/WebservicesInvoicesTest.php b/test/phpunit/WebservicesInvoicesTest.php index 77ad0902ec2..edaed1b9693 100644 --- a/test/phpunit/WebservicesInvoicesTest.php +++ b/test/phpunit/WebservicesInvoicesTest.php @@ -129,9 +129,15 @@ class WebservicesInvoicesTest extends PHPUnit\Framework\TestCase $societe->particulier=0; $societe->create($user); + if (empty($societe->id)) + { + // Create failed, may be the thirdparty already exists, we fetch it + $societe->fetch(0, 'name'); + } self::$socid = $societe->id; - print __METHOD__." societe created id=".$societe->id."\n"; + + print __METHOD__." societe created or found with id=".$societe->id."\n"; $db->begin(); // This is to have all actions inside a transaction even if test launched without suite.