From 8794e54eba9eab2a554aaf47202913a1d5b3f68a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Oct 2017 22:52:57 +0200 Subject: [PATCH] Try to fix phpunit --- htdocs/compta/facture/class/facture.class.php | 8 ++++---- test/phpunit/FactureTest.php | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index cee3bc7e6e2..6195d2a2c35 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3380,10 +3380,10 @@ class Facture extends CommonInvoice { global $conf; - // on verifie si la facture est en numerotation provisoire - $facref = substr($this->ref, 1, 4); + // we check if invoice is a temporary number (PROVxxxx) + $tmppart = substr($this->ref, 1, 4); - if ($this->statut == self::STATUS_DRAFT && $facref == 'PROV') // If draft invoice and ref not yet defined + if ($this->statut == self::STATUS_DRAFT && $tmppart == 'PROV') // If draft invoice and ref not yet defined { return 1; } @@ -3395,7 +3395,7 @@ class Facture extends CommonInvoice // ... // If not a draft invoice and not temporary invoice - if ($facref != 'PROV') + if ($tmppart !== 'PROV') { $maxfacnumber = $this->getNextNumRef($this->thirdparty,'last'); $ventilExportCompta = $this->getVentilExportCompta(); diff --git a/test/phpunit/FactureTest.php b/test/phpunit/FactureTest.php index eed67935032..b6c7218680c 100644 --- a/test/phpunit/FactureTest.php +++ b/test/phpunit/FactureTest.php @@ -284,27 +284,27 @@ class FactureTest extends PHPUnit_Framework_TestCase $result=$localobject2->initAsSpecimen(); $result=$localobject2->create($user); $result=$localobject2->validate($user); - print 'Invoice localobject ref = '.$localobject->ref."\n"; + print 'Invoice $localobject ref = '.$localobject->ref."\n"; print 'Invoice $localobject2 created with ref = '.$localobject2->ref."\n"; $conf->global->INVOICE_CAN_NEVER_BE_REMOVED = 1; $result=$localobject2->delete($user); // Deletion is KO, option INVOICE_CAN_NEVER_BE_REMOVED is on - print __METHOD__." id=".$id." result=".$result."\n"; + print __METHOD__." id=".$localobject2->id." ref=".$localobject2->ref." result=".$result."\n"; $this->assertEquals(0, $result, 'Deletion should fail, option INVOICE_CAN_NEVER_BE_REMOVED is on'); unset($conf->global->INVOICE_CAN_NEVER_BE_REMOVED); $result=$localobject->delete($user); // Deletion is KO, it is not last invoice - print __METHOD__." id=".$id." result=".$result."\n"; + print __METHOD__." id=".$localobject->id." ref=".$localobject->ref." result=".$result."\n"; $this->assertEquals(0, $result, 'Deletion should fail, it is not last invoice'); $result=$localobject2->delete($user); // Deletion is OK, it is last invoice - print __METHOD__." id=".$id." result=".$result."\n"; + print __METHOD__." id=".$localobject2->id." ref=".$localobject2->ref." result=".$result."\n"; $this->assertGreaterThan(0, $result, 'Deletion should work, it is last invoice'); $result=$localobject->delete($user); // Deletion is KO, it is not last invoice - print __METHOD__." id=".$id." result=".$result."\n"; + print __METHOD__." id=".$localobject->id." ref=".$localobject->ref." result=".$result."\n"; $this->assertGreaterThan(0, $result, 'Deletion should work, it is again last invoice'); return $result;