From 246fa9748b708ed2cbc9f86eda4aa713e7b307de Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Sun, 21 May 2017 23:06:45 +0200
Subject: [PATCH] Debug travis error

---
 test/phpunit/ModulesTest.php          |  5 +++++
 test/phpunit/NumberingModulesTest.php | 23 ++++++++++++++---------
 2 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/test/phpunit/ModulesTest.php b/test/phpunit/ModulesTest.php
index e769ce9dd51..a4ff51333e0 100755
--- a/test/phpunit/ModulesTest.php
+++ b/test/phpunit/ModulesTest.php
@@ -143,6 +143,11 @@ class ModulesTest extends PHPUnit_Framework_TestCase
             $result=$mod->init();
         	$this->assertLessThan($result, 0, $modlabel);
         	print __METHOD__." test remove/init for module ".$modlabel.", result=".$result."\n";
+        	
+        	if (in_array($modlabel, array('Ldap', 'MailmanSpip')))
+        	{
+        	    $result=$mod->remove();
+        	}
 		}
 
         return 0;
diff --git a/test/phpunit/NumberingModulesTest.php b/test/phpunit/NumberingModulesTest.php
index e0d175b75d5..d7f3eaf611c 100644
--- a/test/phpunit/NumberingModulesTest.php
+++ b/test/phpunit/NumberingModulesTest.php
@@ -144,30 +144,35 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
 		$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1915);	// we use year 1915 to be sure to not have existing invoice for this year
 		$numbering=new mod_facture_mercure();
 		$result=$numbering->getNextValue($mysoc, $localobject);
-		$result2=$localobject->create($user,1);
-		$result3=$localobject->validate($user, $result);		// create invoice by forcing ref
 		print __METHOD__." result=".$result."\n";
 		$this->assertEquals('1915-0001', $result, 'Test for {yyyy}-{0000}, 1st invoice');				// counter must start to 1
+		$result2=$localobject->create($user,1);
+		print __METHOD__." result2=".$result."\n";
+		$result3=$localobject->validate($user, $result);		// create invoice by forcing ref
+		print __METHOD__." result3=".$result."\n";
+		$this->assertEquals(1, $result3, 'Test validation of invoice with forced ref is ok');	// counter must start to 1
 		$result=$localobject->is_erasable();
 		print __METHOD__." is_erasable=".$result."\n";
-		$this->assertEquals(1, $result, 'Test for is_erasable, 1st invoice');						   // Can be deleted
+		$this->assertEquals(1, $result, 'Test for is_erasable, 1st invoice');						    // Can be deleted
 
+		$out=file_get_contents(DOL_DATA_ROOT.'/dolibarr.log');
+		print $out;
+		
 		$localobject2=new Facture($this->savdb);
 		$localobject2->initAsSpecimen();
 		$localobject2->date=dol_mktime(12, 0, 0, 1, 1, 1916);	// we use following year for second invoice (there is no reset into mask)
 		$numbering=new mod_facture_mercure();
 		$result=$numbering->getNextValue($mysoc, $localobject2, 'last');
 		print __METHOD__." result=".$result."\n";
-
-		$out=file_get_contents(DOL_DATA_ROOT.'/dolibarr.log');
-		print $out;
-		
 		$this->assertEquals('1915-0001', $result, "Test to get last value with param 'last'");
 		$result=$numbering->getNextValue($mysoc, $localobject2);
-		$result2=$localobject2->create($user,1);
-		$result3=$localobject2->validate($user, $result);		// create invoice by forcing ref
 		print __METHOD__." result=".$result."\n";
 		$this->assertEquals('1916-0002', $result);				// counter must be now 2 (not reseted)
+		$result2=$localobject2->create($user,1);
+		print __METHOD__." result2=".$result."\n";
+		$result3=$localobject2->validate($user, $result);		// create invoice by forcing ref
+		print __METHOD__." result3=".$result."\n";
+		$this->assertEquals(1, $result3, 'Test validation of invoice with forced ref is ok');	// counter must start to 1
 		$result=$localobject2->is_erasable();
 		print __METHOD__." is_erasable=".$result."\n";
 		$this->assertEquals(1, $result);						// Can be deleted
-- 
GitLab