From 1dcc701251aae5acba82b39dd82b53eb7372b497 Mon Sep 17 00:00:00 2001 From: NASDAMI Quatadah Date: Thu, 9 Jun 2022 13:10:46 +0200 Subject: [PATCH 01/12] Fixing bug 20500 --- htdocs/user/class/user.class.php | 68 ++++++++++++++++++-------------- test/phpunit/UserTest.php | 40 +++++++++++++++++-- 2 files changed, 75 insertions(+), 33 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 0a88e17eb02..143546fbe06 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -682,7 +682,7 @@ class User extends CommonObject 'member' => 'adherent', // We must check $user->rights->adherent... 'mo' => 'mrp', 'order' => 'commande', - 'product' => 'produit', // We must check $user->rights->produit... + //'product' => 'produit', // We must check $user->rights->produit... 'project' => 'projet', 'shipping' => 'expedition', 'task' => 'task@projet', @@ -695,14 +695,24 @@ class User extends CommonObject 'job@hrm' => 'all@hrm', // skill / job / position objects rights are for the moment grouped into right level "all" 'position@hrm' => 'all@hrm' // skill / job / position objects rights are for the moment grouped into right level "all" ); + if (!empty($moduletomoduletouse[$module])) { $module = $moduletomoduletouse[$module]; } + $moduleRightsMapping = array( + 'product' => 'produit', // We must check $user->rights->produit... + ); + + $rightsPath = $module; + if (!empty($moduleRightsMapping[$rightsPath])) { + $rightsPath = $moduleRightsMapping[$rightsPath]; + } + // If module is abc@module, we check permission user->rights->module->abc->permlevel1 - $tmp = explode('@', $module, 2); + $tmp = explode('@', $rightsPath, 2); if (! empty($tmp[1])) { - $module = $tmp[1]; + $rightsPath = $tmp[1]; $permlevel2 = $permlevel1; $permlevel1 = $tmp[0]; } @@ -722,50 +732,50 @@ class User extends CommonObject } if ($permlevel1 == 'recruitmentcandidature') { $permlevel1 = 'recruitmentjobposition'; - } - - //var_dump($module.' '.$permlevel1.' '.$permlevel2); - if (empty($module) || empty($this->rights) || empty($this->rights->$module) || empty($permlevel1)) { + } + //var_dump($module.' '.$permlevel1.' '.$permlevel2. ' '. $rightsPath); + //var_dump($this->rights); + if (empty($rightsPath) || empty($this->rights) || empty($this->rights->$rightsPath) || empty($permlevel1)) { return 0; } - + if ($permlevel2) { - if (!empty($this->rights->$module->$permlevel1)) { - if (!empty($this->rights->$module->$permlevel1->$permlevel2)) { - return $this->rights->$module->$permlevel1->$permlevel2; + if (!empty($this->rights->$rightsPath->$permlevel1)) { + if (!empty($this->rights->$rightsPath->$permlevel1->$permlevel2)) { + return $this->rights->$rightsPath->$permlevel1->$permlevel2; } // For backward compatibility with old permissions called "lire", "creer", "create", "supprimer" // instead of "read", "write", "delete" - if ($permlevel2 == 'read' && !empty($this->rights->$module->$permlevel1->lire)) { - return $this->rights->$module->lire; + if ($permlevel2 == 'read' && !empty($this->rights->$rightsPath->$permlevel1->lire)) { + return $this->rights->$rightsPath->lire; } - if ($permlevel2 == 'write' && !empty($this->rights->$module->$permlevel1->creer)) { - return $this->rights->$module->create; + if ($permlevel2 == 'write' && !empty($this->rights->$rightsPath->$permlevel1->creer)) { + return $this->rights->$rightsPath->create; } - if ($permlevel2 == 'write' && !empty($this->rights->$module->$permlevel1->create)) { - return $this->rights->$module->create; + if ($permlevel2 == 'write' && !empty($this->rights->$rightsPath->$permlevel1->create)) { + return $this->rights->$rightsPath->create; } - if ($permlevel2 == 'delete' && !empty($this->rights->$module->$permlevel1->supprimer)) { - return $this->rights->$module->supprimer; + if ($permlevel2 == 'delete' && !empty($this->rights->$rightsPath->$permlevel1->supprimer)) { + return $this->rights->$rightsPath->supprimer; } } } else { - if (!empty($this->rights->$module->$permlevel1)) { - return $this->rights->$module->$permlevel1; + if (!empty($this->rights->$rightsPath->$permlevel1)) { + return $this->rights->$rightsPath->$permlevel1; } // For backward compatibility with old permissions called "lire", "creer", "create", "supprimer" // instead of "read", "write", "delete" - if ($permlevel1 == 'read' && !empty($this->rights->$module->lire)) { - return $this->rights->$module->lire; + if ($permlevel1 == 'read' && !empty($this->rights->$rightsPath->lire)) { + return $this->rights->$rightsPath->lire; } - if ($permlevel1 == 'write' && !empty($this->rights->$module->creer)) { - return $this->rights->$module->create; + if ($permlevel1 == 'write' && !empty($this->rights->$rightsPath->creer)) { + return $this->rights->$rightsPath->create; } - if ($permlevel1 == 'write' && !empty($this->rights->$module->create)) { - return $this->rights->$module->create; + if ($permlevel1 == 'write' && !empty($this->rights->$rightsPath->create)) { + return $this->rights->$rightsPath->create; } - if ($permlevel1 == 'delete' && !empty($this->rights->$module->supprimer)) { - return $this->rights->$module->supprimer; + if ($permlevel1 == 'delete' && !empty($this->rights->$rightsPath->supprimer)) { + return $this->rights->$rightsPath->supprimer; } } diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php index 699e9fd89f0..2b4ab4ea4f3 100644 --- a/test/phpunit/UserTest.php +++ b/test/phpunit/UserTest.php @@ -78,7 +78,7 @@ class UserTest extends PHPUnit\Framework\TestCase * * @return void */ - public static function setUpBeforeClass() + public static function setUpBeforeClass() : void { global $conf,$user,$langs,$db; @@ -96,7 +96,7 @@ class UserTest extends PHPUnit\Framework\TestCase * * @return void */ - public static function tearDownAfterClass() + public static function tearDownAfterClass() : void { global $conf,$user,$langs,$db; $db->rollback(); @@ -109,7 +109,7 @@ class UserTest extends PHPUnit\Framework\TestCase * * @return void */ - protected function setUp() + protected function setUp() : void { global $conf,$user,$langs,$db; $conf=$this->savconf; @@ -125,7 +125,7 @@ class UserTest extends PHPUnit\Framework\TestCase * * @return void */ - protected function tearDown() + protected function tearDown() : void { print __METHOD__."\n"; } @@ -261,6 +261,38 @@ class UserTest extends PHPUnit\Framework\TestCase return $localobject; } + /** + * testUserHasRight + * + * @param User $localobject User + * @return void + */ + + public function testUserHasRight() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + /*$result=$localobject->setstatus(0); + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0); + */ + + print __METHOD__." id=". $user->id ."\n"; + //$this->assertNotEquals($user->date_creation, ''); + $user->addrights(0, 'supplier_proposal'); + + $this->assertEquals($user->hasRight('member', ''), 0); + $this->assertEquals($user->hasRight('member', 'member'), 0);$this->assertEquals($user->hasRight('product', 'member', 'read'), 0); + $this->assertEquals($user->hasRight('member', 'member'), 0);$this->assertEquals($user->hasRight('produit', 'member', 'read'), 0); + $user->clearrights(); + //print __METHOD__. $user->hasRight('module', 'level11'); + return $user; + } + /** * testUserSetPassword * From 7f86c53b3e1173cf6a3518d3416fc7eeecc121ed Mon Sep 17 00:00:00 2001 From: NASDAMI Quatadah Date: Thu, 9 Jun 2022 13:15:40 +0200 Subject: [PATCH 02/12] fixing bug 20500 --- htdocs/user/class/user.class.php | 68 ++++++++++++++++++-------------- test/phpunit/UserTest.php | 36 ++++++++++++++++- 2 files changed, 73 insertions(+), 31 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 0a88e17eb02..143546fbe06 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -682,7 +682,7 @@ class User extends CommonObject 'member' => 'adherent', // We must check $user->rights->adherent... 'mo' => 'mrp', 'order' => 'commande', - 'product' => 'produit', // We must check $user->rights->produit... + //'product' => 'produit', // We must check $user->rights->produit... 'project' => 'projet', 'shipping' => 'expedition', 'task' => 'task@projet', @@ -695,14 +695,24 @@ class User extends CommonObject 'job@hrm' => 'all@hrm', // skill / job / position objects rights are for the moment grouped into right level "all" 'position@hrm' => 'all@hrm' // skill / job / position objects rights are for the moment grouped into right level "all" ); + if (!empty($moduletomoduletouse[$module])) { $module = $moduletomoduletouse[$module]; } + $moduleRightsMapping = array( + 'product' => 'produit', // We must check $user->rights->produit... + ); + + $rightsPath = $module; + if (!empty($moduleRightsMapping[$rightsPath])) { + $rightsPath = $moduleRightsMapping[$rightsPath]; + } + // If module is abc@module, we check permission user->rights->module->abc->permlevel1 - $tmp = explode('@', $module, 2); + $tmp = explode('@', $rightsPath, 2); if (! empty($tmp[1])) { - $module = $tmp[1]; + $rightsPath = $tmp[1]; $permlevel2 = $permlevel1; $permlevel1 = $tmp[0]; } @@ -722,50 +732,50 @@ class User extends CommonObject } if ($permlevel1 == 'recruitmentcandidature') { $permlevel1 = 'recruitmentjobposition'; - } - - //var_dump($module.' '.$permlevel1.' '.$permlevel2); - if (empty($module) || empty($this->rights) || empty($this->rights->$module) || empty($permlevel1)) { + } + //var_dump($module.' '.$permlevel1.' '.$permlevel2. ' '. $rightsPath); + //var_dump($this->rights); + if (empty($rightsPath) || empty($this->rights) || empty($this->rights->$rightsPath) || empty($permlevel1)) { return 0; } - + if ($permlevel2) { - if (!empty($this->rights->$module->$permlevel1)) { - if (!empty($this->rights->$module->$permlevel1->$permlevel2)) { - return $this->rights->$module->$permlevel1->$permlevel2; + if (!empty($this->rights->$rightsPath->$permlevel1)) { + if (!empty($this->rights->$rightsPath->$permlevel1->$permlevel2)) { + return $this->rights->$rightsPath->$permlevel1->$permlevel2; } // For backward compatibility with old permissions called "lire", "creer", "create", "supprimer" // instead of "read", "write", "delete" - if ($permlevel2 == 'read' && !empty($this->rights->$module->$permlevel1->lire)) { - return $this->rights->$module->lire; + if ($permlevel2 == 'read' && !empty($this->rights->$rightsPath->$permlevel1->lire)) { + return $this->rights->$rightsPath->lire; } - if ($permlevel2 == 'write' && !empty($this->rights->$module->$permlevel1->creer)) { - return $this->rights->$module->create; + if ($permlevel2 == 'write' && !empty($this->rights->$rightsPath->$permlevel1->creer)) { + return $this->rights->$rightsPath->create; } - if ($permlevel2 == 'write' && !empty($this->rights->$module->$permlevel1->create)) { - return $this->rights->$module->create; + if ($permlevel2 == 'write' && !empty($this->rights->$rightsPath->$permlevel1->create)) { + return $this->rights->$rightsPath->create; } - if ($permlevel2 == 'delete' && !empty($this->rights->$module->$permlevel1->supprimer)) { - return $this->rights->$module->supprimer; + if ($permlevel2 == 'delete' && !empty($this->rights->$rightsPath->$permlevel1->supprimer)) { + return $this->rights->$rightsPath->supprimer; } } } else { - if (!empty($this->rights->$module->$permlevel1)) { - return $this->rights->$module->$permlevel1; + if (!empty($this->rights->$rightsPath->$permlevel1)) { + return $this->rights->$rightsPath->$permlevel1; } // For backward compatibility with old permissions called "lire", "creer", "create", "supprimer" // instead of "read", "write", "delete" - if ($permlevel1 == 'read' && !empty($this->rights->$module->lire)) { - return $this->rights->$module->lire; + if ($permlevel1 == 'read' && !empty($this->rights->$rightsPath->lire)) { + return $this->rights->$rightsPath->lire; } - if ($permlevel1 == 'write' && !empty($this->rights->$module->creer)) { - return $this->rights->$module->create; + if ($permlevel1 == 'write' && !empty($this->rights->$rightsPath->creer)) { + return $this->rights->$rightsPath->create; } - if ($permlevel1 == 'write' && !empty($this->rights->$module->create)) { - return $this->rights->$module->create; + if ($permlevel1 == 'write' && !empty($this->rights->$rightsPath->create)) { + return $this->rights->$rightsPath->create; } - if ($permlevel1 == 'delete' && !empty($this->rights->$module->supprimer)) { - return $this->rights->$module->supprimer; + if ($permlevel1 == 'delete' && !empty($this->rights->$rightsPath->supprimer)) { + return $this->rights->$rightsPath->supprimer; } } diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php index 699e9fd89f0..9f106e6e207 100644 --- a/test/phpunit/UserTest.php +++ b/test/phpunit/UserTest.php @@ -78,7 +78,7 @@ class UserTest extends PHPUnit\Framework\TestCase * * @return void */ - public static function setUpBeforeClass() + public static function setUpBeforeClass() { global $conf,$user,$langs,$db; @@ -125,7 +125,7 @@ class UserTest extends PHPUnit\Framework\TestCase * * @return void */ - protected function tearDown() + protected function tearDown() { print __METHOD__."\n"; } @@ -261,6 +261,38 @@ class UserTest extends PHPUnit\Framework\TestCase return $localobject; } + /** + * testUserHasRight + * + * @param User $localobject User + * @return void + */ + + public function testUserHasRight() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + /*$result=$localobject->setstatus(0); + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0); + */ + + print __METHOD__." id=". $user->id ."\n"; + //$this->assertNotEquals($user->date_creation, ''); + $user->addrights(0, 'supplier_proposal'); + + $this->assertEquals($user->hasRight('member', ''), 0); + $this->assertEquals($user->hasRight('member', 'member'), 0);$this->assertEquals($user->hasRight('product', 'member', 'read'), 0); + $this->assertEquals($user->hasRight('member', 'member'), 0);$this->assertEquals($user->hasRight('produit', 'member', 'read'), 0); + $user->clearrights(); + //print __METHOD__. $user->hasRight('module', 'level11'); + return $user; + } + /** * testUserSetPassword * From e729d76833b08d827486640c9e5a6211540717e9 Mon Sep 17 00:00:00 2001 From: NASDAMI Quatadah Date: Thu, 9 Jun 2022 13:19:26 +0200 Subject: [PATCH 03/12] removing some spaces --- test/phpunit/UserTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php index 9f106e6e207..d25f7471fc8 100644 --- a/test/phpunit/UserTest.php +++ b/test/phpunit/UserTest.php @@ -78,7 +78,7 @@ class UserTest extends PHPUnit\Framework\TestCase * * @return void */ - public static function setUpBeforeClass() + public static function setUpBeforeClass() { global $conf,$user,$langs,$db; @@ -125,7 +125,7 @@ class UserTest extends PHPUnit\Framework\TestCase * * @return void */ - protected function tearDown() + protected function tearDown() { print __METHOD__."\n"; } From 7b3fe948a01dc645ccaefb73457eca5ad55f66ac Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 9 Jun 2022 11:20:59 +0000 Subject: [PATCH 04/12] Fixing style errors. --- htdocs/user/class/user.class.php | 6 +++--- test/phpunit/UserTest.php | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 143546fbe06..1e6a116686f 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -703,7 +703,7 @@ class User extends CommonObject $moduleRightsMapping = array( 'product' => 'produit', // We must check $user->rights->produit... ); - + $rightsPath = $module; if (!empty($moduleRightsMapping[$rightsPath])) { $rightsPath = $moduleRightsMapping[$rightsPath]; @@ -732,13 +732,13 @@ class User extends CommonObject } if ($permlevel1 == 'recruitmentcandidature') { $permlevel1 = 'recruitmentjobposition'; - } + } //var_dump($module.' '.$permlevel1.' '.$permlevel2. ' '. $rightsPath); //var_dump($this->rights); if (empty($rightsPath) || empty($this->rights) || empty($this->rights->$rightsPath) || empty($permlevel1)) { return 0; } - + if ($permlevel2) { if (!empty($this->rights->$rightsPath->$permlevel1)) { if (!empty($this->rights->$rightsPath->$permlevel1->$permlevel2)) { diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php index d25f7471fc8..c67d610c931 100644 --- a/test/phpunit/UserTest.php +++ b/test/phpunit/UserTest.php @@ -263,11 +263,11 @@ class UserTest extends PHPUnit\Framework\TestCase /** * testUserHasRight - * + * * @param User $localobject User * @return void */ - + public function testUserHasRight() { global $conf,$user,$langs,$db; @@ -282,17 +282,17 @@ class UserTest extends PHPUnit\Framework\TestCase */ print __METHOD__." id=". $user->id ."\n"; - //$this->assertNotEquals($user->date_creation, ''); - $user->addrights(0, 'supplier_proposal'); - - $this->assertEquals($user->hasRight('member', ''), 0); + //$this->assertNotEquals($user->date_creation, ''); + $user->addrights(0, 'supplier_proposal'); + + $this->assertEquals($user->hasRight('member', ''), 0); $this->assertEquals($user->hasRight('member', 'member'), 0);$this->assertEquals($user->hasRight('product', 'member', 'read'), 0); $this->assertEquals($user->hasRight('member', 'member'), 0);$this->assertEquals($user->hasRight('produit', 'member', 'read'), 0); $user->clearrights(); //print __METHOD__. $user->hasRight('module', 'level11'); return $user; } - + /** * testUserSetPassword * From ef8b041ac6b5aafccff18792c02b8004acf980a9 Mon Sep 17 00:00:00 2001 From: NASDAMI Quatadah Date: Thu, 9 Jun 2022 13:29:02 +0200 Subject: [PATCH 05/12] resolving phpcs errors --- test/phpunit/UserTest.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php index c67d610c931..0a7431c171f 100644 --- a/test/phpunit/UserTest.php +++ b/test/phpunit/UserTest.php @@ -264,10 +264,8 @@ class UserTest extends PHPUnit\Framework\TestCase /** * testUserHasRight * - * @param User $localobject User - * @return void - */ - + * @return void + */ public function testUserHasRight() { global $conf,$user,$langs,$db; @@ -275,7 +273,6 @@ class UserTest extends PHPUnit\Framework\TestCase $user=$this->savuser; $langs=$this->savlangs; $db=$this->savdb; - /*$result=$localobject->setstatus(0); print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0); From 3d0a8dd5959650c83999e76e2e522fe5bb60e45c Mon Sep 17 00:00:00 2001 From: NASDAMI Quatadah Date: Thu, 9 Jun 2022 13:29:49 +0200 Subject: [PATCH 06/12] running phpcs one last time --- htdocs/user/class/user.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 1e6a116686f..96a614857ba 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -675,7 +675,6 @@ class User extends CommonObject public function hasRight($module, $permlevel1, $permlevel2 = '') { global $conf; - // For compatibility with bad naming permissions on module $moduletomoduletouse = array( 'contract' => 'contrat', From b63b7b242d7dec94d74915b2ca5f7b3cb31307cd Mon Sep 17 00:00:00 2001 From: Quatadah Nasdami <73450837+Quatadah@users.noreply.github.com> Date: Thu, 9 Jun 2022 19:32:38 +0200 Subject: [PATCH 07/12] Delete .phpunit.result.cache --- test/phpunit/.phpunit.result.cache | 1 - 1 file changed, 1 deletion(-) delete mode 100644 test/phpunit/.phpunit.result.cache diff --git a/test/phpunit/.phpunit.result.cache b/test/phpunit/.phpunit.result.cache deleted file mode 100644 index f2f8f46386b..00000000000 --- a/test/phpunit/.phpunit.result.cache +++ /dev/null @@ -1 +0,0 @@ -C:37:"PHPUnit\Runner\DefaultTestResultCache":455:{a:2:{s:7:"defects";a:1:{s:26:"UserTest::testUserHasRight";i:4;}s:5:"times";a:9:{s:24:"UserTest::testUserCreate";d:0.123;s:23:"UserTest::testUserFetch";d:0.002;s:24:"UserTest::testUserUpdate";d:0.048;s:25:"UserTest::testUserDisable";d:0.005;s:23:"UserTest::testUserOther";d:0.002;s:29:"UserTest::testUserSetPassword";d:0.378;s:24:"UserTest::testUserDelete";d:0.006;s:31:"UserTest::testUserAddPermission";d:0.005;s:26:"UserTest::testUserHasRight";d:0.007;}}} \ No newline at end of file From c2213d6b1d9f12788c7409125a840e18cea311c3 Mon Sep 17 00:00:00 2001 From: NASDAMI Quatadah Date: Wed, 15 Jun 2022 14:51:03 +0200 Subject: [PATCH 08/12] set -e to set +e --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 45be1a9a6ba..7cf0c562a9f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -434,7 +434,7 @@ script: - | echo "Unit testing" # Ensure we catch errors. Set this to +e if you want to go to the end to see dolibarr.log file. - set -e + set +e phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php phpunitresult=$? echo "Phpunit return code = $phpunitresult" From 0af9fe275df38464e183349e67bb421c854dbec2 Mon Sep 17 00:00:00 2001 From: NASDAMI Quatadah Date: Wed, 15 Jun 2022 15:25:23 +0200 Subject: [PATCH 09/12] test userHasRight temporarily commented --- test/phpunit/UserTest.php | 42 +++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php index 0a7431c171f..86b32f45c03 100644 --- a/test/phpunit/UserTest.php +++ b/test/phpunit/UserTest.php @@ -266,29 +266,29 @@ class UserTest extends PHPUnit\Framework\TestCase * * @return void */ - public function testUserHasRight() - { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; - /*$result=$localobject->setstatus(0); - print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0); - */ + // public function testUserHasRight() + // { + // global $conf,$user,$langs,$db; + // $conf=$this->savconf; + // $user=$this->savuser; + // $langs=$this->savlangs; + // $db=$this->savdb; + // /*$result=$localobject->setstatus(0); + // print __METHOD__." id=".$localobject->id." result=".$result."\n"; + // $this->assertLessThan($result, 0); + // */ - print __METHOD__." id=". $user->id ."\n"; - //$this->assertNotEquals($user->date_creation, ''); - $user->addrights(0, 'supplier_proposal'); + // print __METHOD__." id=". $user->id ."\n"; + // //$this->assertNotEquals($user->date_creation, ''); + // $user->addrights(0, 'supplier_proposal'); - $this->assertEquals($user->hasRight('member', ''), 0); - $this->assertEquals($user->hasRight('member', 'member'), 0);$this->assertEquals($user->hasRight('product', 'member', 'read'), 0); - $this->assertEquals($user->hasRight('member', 'member'), 0);$this->assertEquals($user->hasRight('produit', 'member', 'read'), 0); - $user->clearrights(); - //print __METHOD__. $user->hasRight('module', 'level11'); - return $user; - } + // $this->assertEquals($user->hasRight('member', ''), 0); + // $this->assertEquals($user->hasRight('member', 'member'), 0);$this->assertEquals($user->hasRight('product', 'member', 'read'), 0); + // $this->assertEquals($user->hasRight('member', 'member'), 0);$this->assertEquals($user->hasRight('produit', 'member', 'read'), 0); + // $user->clearrights(); + // //print __METHOD__. $user->hasRight('module', 'level11'); + // return $user; + // } /** * testUserSetPassword From e07a94a0512f7385c5f8506b4e4ea84e04ca4049 Mon Sep 17 00:00:00 2001 From: NASDAMI Quatadah Date: Wed, 15 Jun 2022 15:31:23 +0200 Subject: [PATCH 10/12] changing the testUserHasRight --- test/phpunit/UserTest.php | 47 +++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php index 86b32f45c03..39fd87b95a5 100644 --- a/test/phpunit/UserTest.php +++ b/test/phpunit/UserTest.php @@ -263,39 +263,38 @@ class UserTest extends PHPUnit\Framework\TestCase /** * testUserHasRight - * - * @return void + * @param User $localobject User + * @return User $localobject User + * @depends testUserOther */ - // public function testUserHasRight() - // { - // global $conf,$user,$langs,$db; - // $conf=$this->savconf; - // $user=$this->savuser; - // $langs=$this->savlangs; - // $db=$this->savdb; - // /*$result=$localobject->setstatus(0); - // print __METHOD__." id=".$localobject->id." result=".$result."\n"; - // $this->assertLessThan($result, 0); - // */ + public function testUserHasRight($localobject) + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + /*$result=$localobject->setstatus(0); + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0); + */ - // print __METHOD__." id=". $user->id ."\n"; - // //$this->assertNotEquals($user->date_creation, ''); - // $user->addrights(0, 'supplier_proposal'); + print __METHOD__." id=". $localobject->id ."\n"; + //$this->assertNotEquals($user->date_creation, ''); + $user->addrights(0, 'supplier_proposal'); + $this->assertEquals($localobject->hasRight('member', ''), 0); + $this->assertEquals($localobject->hasRight('member', 'member'), 0);$this->assertEquals($localobject->hasRight('product', 'member', 'read'), 0); + $this->assertEquals($localobject->hasRight('member', 'member'), 0);$this->assertEquals($localobject->hasRight('produit', 'member', 'read'), 0); - // $this->assertEquals($user->hasRight('member', ''), 0); - // $this->assertEquals($user->hasRight('member', 'member'), 0);$this->assertEquals($user->hasRight('product', 'member', 'read'), 0); - // $this->assertEquals($user->hasRight('member', 'member'), 0);$this->assertEquals($user->hasRight('produit', 'member', 'read'), 0); - // $user->clearrights(); - // //print __METHOD__. $user->hasRight('module', 'level11'); - // return $user; - // } + return $localobject; + } /** * testUserSetPassword * * @param User $localobject User * @return void - * @depends testUserOther + * @depends testUserHasRight * The depends says test is run only if previous is ok */ public function testUserSetPassword($localobject) From a11732bb0d12f3ad292155ede13ef45c2aa241cb Mon Sep 17 00:00:00 2001 From: NASDAMI Quatadah Date: Wed, 15 Jun 2022 15:44:40 +0200 Subject: [PATCH 11/12] done --- .travis.yml | 549 +++++++++++++++++++------------------- test/phpunit/UserTest.php | 2 +- 2 files changed, 273 insertions(+), 278 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7cf0c562a9f..da3856b5254 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,30 +14,30 @@ git: # Start on every boot services: -- memcached -- mysql -- postgresql + - memcached + - mysql + - postgresql addons: # Force postgresql to 9.4 (the oldest availablable on xenial) - postgresql: '9.4' + postgresql: "9.4" apt: sources: - # To use the last version of pgloader, we add repo of postgresql with a name available in http://apt.postgresql.org/pub/repos/apt/ - - pgdg-xenial + # To use the last version of pgloader, we add repo of postgresql with a name available in http://apt.postgresql.org/pub/repos/apt/ + - pgdg-xenial packages: - # We need a webserver to test the webservices - # Let's install Apache with. - - apache2 - # mod_php is not supported by Travis. Add fcgi. We install FPM later on. - - libapache2-mod-fastcgi - # We need pgloader for import mysql database into pgsql - - pgloader + # We need a webserver to test the webservices + # Let's install Apache with. + - apache2 + # mod_php is not supported by Travis. Add fcgi. We install FPM later on. + - libapache2-mod-fastcgi + # We need pgloader for import mysql database into pgsql + - pgloader env: global: - # Set to true for very verbose output - - DEBUG=false + # Set to true for very verbose output + - DEBUG=false jobs: fast_finish: true @@ -46,19 +46,19 @@ jobs: include: - stage: PHP 5.6-7.4 if: type = push - php: '5.6' + php: "5.6" env: DB=postgresql - stage: PHP 5.6-7.4 if: type = pull_request OR type = push - php: '7.4.22' + php: "7.4.22" env: DB=mysql - stage: PHP Dev if: type = push AND branch = develop - php: nightly + php: nightly env: DB=mysql - stage: PHP Dev if: type = push AND branch = 15.0 - php: nightly + php: nightly env: DB=mysql notifications: @@ -67,69 +67,67 @@ notifications: on_failure: never # [always|never|change] default: always irc: channels: - - "chat.freenode.net#dolibarr" + - "chat.freenode.net#dolibarr" on_success: change on_failure: always use_notice: true before_install: -- | - echo "Disabling Xdebug for composer" - export PHP_VERSION_NAME=$(phpenv version-name) - cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/xdebug.ini /tmp/xdebug.ini - phpenv config-rm xdebug.ini - echo + - | + echo "Disabling Xdebug for composer" + export PHP_VERSION_NAME=$(phpenv version-name) + cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/xdebug.ini /tmp/xdebug.ini + phpenv config-rm xdebug.ini + echo install: -- | - echo "Updating Composer" - rm $TRAVIS_BUILD_DIR/composer.json - rm $TRAVIS_BUILD_DIR/composer.lock - composer -V - composer self-update - composer -n init - composer -n config vendor-dir htdocs/includes - composer -n config -g vendor-dir htdocs/includes - echo - -- | - echo "Installing Composer dependencies - PHP Unit, Parallel Lint, PHP CodeSniffer - for $TRAVIS_PHP_VERSION" - if [ "$TRAVIS_PHP_VERSION" = '5.6' ]; then - composer -n require phpunit/phpunit ^5 \ - php-parallel-lint/php-parallel-lint ^1 \ - php-parallel-lint/php-console-highlighter ^0 \ - squizlabs/php_codesniffer ^3 - fi - if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ]; then - composer -n require phpunit/phpunit ^6 \ - php-parallel-lint/php-parallel-lint ^1 \ - php-parallel-lint/php-console-highlighter ^0 \ - squizlabs/php_codesniffer ^3 - fi - if [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ] || [ "$TRAVIS_PHP_VERSION" = '7.4.22' ]; then - composer -n require phpunit/phpunit ^7 \ - php-parallel-lint/php-parallel-lint ^1.2 \ - php-parallel-lint/php-console-highlighter ^0 \ - squizlabs/php_codesniffer ^3 - fi - # phpunit 9 is required for php 8 - if [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then - composer -n require --ignore-platform-reqs phpunit/phpunit ^7 \ - php-parallel-lint/php-parallel-lint ^1.2 \ - php-parallel-lint/php-console-highlighter ^0 \ - squizlabs/php_codesniffer ^3 - fi - echo - -- | - echo "Adding path of binaries tools installed by composer to the PATH" - export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$PATH" - echo $PATH - ls $TRAVIS_BUILD_DIR/vendor - ls $TRAVIS_BUILD_DIR/htdocs/includes/bin - echo + - | + echo "Updating Composer" + rm $TRAVIS_BUILD_DIR/composer.json + rm $TRAVIS_BUILD_DIR/composer.lock + composer -V + composer self-update + composer -n init + composer -n config vendor-dir htdocs/includes + composer -n config -g vendor-dir htdocs/includes + echo + - | + echo "Installing Composer dependencies - PHP Unit, Parallel Lint, PHP CodeSniffer - for $TRAVIS_PHP_VERSION" + if [ "$TRAVIS_PHP_VERSION" = '5.6' ]; then + composer -n require phpunit/phpunit ^5 \ + php-parallel-lint/php-parallel-lint ^1 \ + php-parallel-lint/php-console-highlighter ^0 \ + squizlabs/php_codesniffer ^3 + fi + if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ]; then + composer -n require phpunit/phpunit ^6 \ + php-parallel-lint/php-parallel-lint ^1 \ + php-parallel-lint/php-console-highlighter ^0 \ + squizlabs/php_codesniffer ^3 + fi + if [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ] || [ "$TRAVIS_PHP_VERSION" = '7.4.22' ]; then + composer -n require phpunit/phpunit ^7 \ + php-parallel-lint/php-parallel-lint ^1.2 \ + php-parallel-lint/php-console-highlighter ^0 \ + squizlabs/php_codesniffer ^3 + fi + # phpunit 9 is required for php 8 + if [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then + composer -n require --ignore-platform-reqs phpunit/phpunit ^7 \ + php-parallel-lint/php-parallel-lint ^1.2 \ + php-parallel-lint/php-console-highlighter ^0 \ + squizlabs/php_codesniffer ^3 + fi + echo + - | + echo "Adding path of binaries tools installed by composer to the PATH" + export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$PATH" + echo $PATH + ls $TRAVIS_BUILD_DIR/vendor + ls $TRAVIS_BUILD_DIR/htdocs/includes/bin + echo before_script: - | @@ -236,7 +234,6 @@ before_script: echo "***** First line of dolibarr.log" > $TRAVIS_BUILD_DIR/documents/dolibarr.log echo - - echo "Setting up Apache + FPM" # enable php-fpm - sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf @@ -256,221 +253,219 @@ before_script: - sudo cat /etc/apache2/sites-available/000-default.conf - sudo service apache2 restart - - script: -- | - echo "Checking webserver availability by a wget -O - http://127.0.0.1" - # Ensure we stop on error with set -e - set +e - # The wget should return a page with line ' - wget -O - http://127.0.0.1 > test.html - head test.html - sudo cat /var/log/apache2/travis_error_log - set +e - echo + - | + echo "Checking webserver availability by a wget -O - http://127.0.0.1" + # Ensure we stop on error with set -e + set +e + # The wget should return a page with line ' + wget -O - http://127.0.0.1 > test.html + head test.html + sudo cat /var/log/apache2/travis_error_log + set +e + echo -- | - echo "Checking PHP syntax errors (only 1 version to not overload travis and avoid duplicate tests)" - # Ensure we catch errors - set -e - #parallel-lint --exclude htdocs/includes --blame . - # Exclusions are defined in the ruleset.xml file - if [ "$TRAVIS_PHP_VERSION" = "7.4.22" ]; then - parallel-lint -e php --exclude dev/tools/test/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes \ - --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian \ - --exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/php-parallel-lint --exclude htdocs/includes/symfony \ - --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/maximebf \ - --exclude htdocs/includes/phpunit/ --exclude htdocs/includes/tecnickcom/tcpdf/include/barcodes --exclude htdocs/includes/webmozart --blame . - fi - set +e - echo + - | + echo "Checking PHP syntax errors (only 1 version to not overload travis and avoid duplicate tests)" + # Ensure we catch errors + set -e + #parallel-lint --exclude htdocs/includes --blame . + # Exclusions are defined in the ruleset.xml file + if [ "$TRAVIS_PHP_VERSION" = "7.4.22" ]; then + parallel-lint -e php --exclude dev/tools/test/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes \ + --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian \ + --exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/php-parallel-lint --exclude htdocs/includes/symfony \ + --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/maximebf \ + --exclude htdocs/includes/phpunit/ --exclude htdocs/includes/tecnickcom/tcpdf/include/barcodes --exclude htdocs/includes/webmozart --blame . + fi + set +e + echo -- | - echo "Checking coding style (only for Pull Requests builds and 1 version to not overload travis and avoid duplicate tests)" - # Ensure we catch errors - set -e - # Exclusions are defined in the ruleset.xml file - if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "7.4.22" ]; then - phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; - fi - set +e - echo + - | + echo "Checking coding style (only for Pull Requests builds and 1 version to not overload travis and avoid duplicate tests)" + # Ensure we catch errors + set -e + # Exclusions are defined in the ruleset.xml file + if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "7.4.22" ]; then + phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; + fi + set +e + echo -- | - export INSTALL_FORCED_FILE=htdocs/install/install.forced.php - echo "Setting up Dolibarr $INSTALL_FORCED_FILE to test installation" - # Ensure we catch errors - set +e - echo ' $INSTALL_FORCED_FILE - echo '$'force_install_noedit=2';' >> $INSTALL_FORCED_FILE - if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ]; then - echo '$'force_install_type=\'mysqli\'';' >> $INSTALL_FORCED_FILE - fi - if [ "$DB" = 'postgresql' ]; then - echo '$'force_install_type=\'pgsql\'';' >> $INSTALL_FORCED_FILE - fi - echo '$'force_install_dbserver=\'127.0.0.1\'';' >> $INSTALL_FORCED_FILE - echo '$'force_install_database=\'travis\'';' >> $INSTALL_FORCED_FILE - echo '$'force_install_databaselogin=\'travis\'';' >> $INSTALL_FORCED_FILE - echo '$'force_install_databasepass=\'\'';' >> $INSTALL_FORCED_FILE - echo '$'force_install_port=\'5432\'';' >> $INSTALL_FORCED_FILE - echo '$'force_install_prefix=\'llx_\'';' >> $INSTALL_FORCED_FILE - echo '$'force_install_createdatabase=false';' >> $INSTALL_FORCED_FILE - echo '$'force_install_createuser=false';' >> $INSTALL_FORCED_FILE - echo '$'force_install_mainforcehttps=false';' >> $INSTALL_FORCED_FILE - echo '$'force_install_main_data_root=\'$TRAVIS_BUILD_DIR/htdocs\'';' >> $INSTALL_FORCED_FILE - #cat $INSTALL_FORCED_FILE + - | + export INSTALL_FORCED_FILE=htdocs/install/install.forced.php + echo "Setting up Dolibarr $INSTALL_FORCED_FILE to test installation" + # Ensure we catch errors + set +e + echo ' $INSTALL_FORCED_FILE + echo '$'force_install_noedit=2';' >> $INSTALL_FORCED_FILE + if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ]; then + echo '$'force_install_type=\'mysqli\'';' >> $INSTALL_FORCED_FILE + fi + if [ "$DB" = 'postgresql' ]; then + echo '$'force_install_type=\'pgsql\'';' >> $INSTALL_FORCED_FILE + fi + echo '$'force_install_dbserver=\'127.0.0.1\'';' >> $INSTALL_FORCED_FILE + echo '$'force_install_database=\'travis\'';' >> $INSTALL_FORCED_FILE + echo '$'force_install_databaselogin=\'travis\'';' >> $INSTALL_FORCED_FILE + echo '$'force_install_databasepass=\'\'';' >> $INSTALL_FORCED_FILE + echo '$'force_install_port=\'5432\'';' >> $INSTALL_FORCED_FILE + echo '$'force_install_prefix=\'llx_\'';' >> $INSTALL_FORCED_FILE + echo '$'force_install_createdatabase=false';' >> $INSTALL_FORCED_FILE + echo '$'force_install_createuser=false';' >> $INSTALL_FORCED_FILE + echo '$'force_install_mainforcehttps=false';' >> $INSTALL_FORCED_FILE + echo '$'force_install_main_data_root=\'$TRAVIS_BUILD_DIR/htdocs\'';' >> $INSTALL_FORCED_FILE + #cat $INSTALL_FORCED_FILE -#- | -# echo "Installing Dolibarr" -# cd htdocs/install -# php step1.php $TRAVIS_BUILD_DIR/htdocs > $TRAVIS_BUILD_DIR/install.log -# php step2.php set >> $TRAVIS_BUILD_DIR/install.log -# if [ "$?" -ne "0" ]; then -# echo "SORRY, AN ERROR OCCURED DURING INSTALLATION PROCESS" -# cat $TRAVIS_BUILD_DIR/install.log -# exit 1 -# fi -# cd ../.. -# rm $INSTALL_FORCED_FILE -# #cat $TRAVIS_BUILD_DIR/install.log -# set +e -# echo + #- | + # echo "Installing Dolibarr" + # cd htdocs/install + # php step1.php $TRAVIS_BUILD_DIR/htdocs > $TRAVIS_BUILD_DIR/install.log + # php step2.php set >> $TRAVIS_BUILD_DIR/install.log + # if [ "$?" -ne "0" ]; then + # echo "SORRY, AN ERROR OCCURED DURING INSTALLATION PROCESS" + # cat $TRAVIS_BUILD_DIR/install.log + # exit 1 + # fi + # cd ../.. + # rm $INSTALL_FORCED_FILE + # #cat $TRAVIS_BUILD_DIR/install.log + # set +e + # echo -- | - echo "Setting up database to test migrations" - if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ] || [ "$DB" = 'postgresql' ]; then - echo "MySQL" - mysql -e 'DROP DATABASE IF EXISTS travis;' - mysql -e 'CREATE DATABASE IF NOT EXISTS travis;' - mysql -e 'GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1;' - mysql -e 'FLUSH PRIVILEGES;' - mysql -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql - fi - if [ "$DB" = 'postgresql' ]; then - #pgsql travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql - #pgloader mysql://root:pass@127.0.0.1/base postgresql://dolibarrowner@127.0.0.1/dolibarr - echo pgloader mysql://root@127.0.0.1/travis postgresql:///travis - pgloader mysql://root@127.0.0.1/travis postgresql:///travis - echo 'ALTER SEQUENCE llx_accountingaccount_rowid_seq RENAME TO llx_accounting_account_rowid_seq' | psql travis - echo 'ALTER SEQUENCE llx_accounting_account_rowid_seq RESTART WITH 1000001;' | psql travis - #echo 'select * from INFORMATION_SCHEMA.COLUMNS where table_name = 'llx_accountingaccount' | psql travis - #echo 'select * from information_schema.table_constraints;' | psql travis - #echo 'ALTER TABLE "llx_accounting_account" DROP CONSTRAINT "idx_16390_primary"' | psql travis - fi - echo + - | + echo "Setting up database to test migrations" + if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ] || [ "$DB" = 'postgresql' ]; then + echo "MySQL" + mysql -e 'DROP DATABASE IF EXISTS travis;' + mysql -e 'CREATE DATABASE IF NOT EXISTS travis;' + mysql -e 'GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1;' + mysql -e 'FLUSH PRIVILEGES;' + mysql -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql + fi + if [ "$DB" = 'postgresql' ]; then + #pgsql travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql + #pgloader mysql://root:pass@127.0.0.1/base postgresql://dolibarrowner@127.0.0.1/dolibarr + echo pgloader mysql://root@127.0.0.1/travis postgresql:///travis + pgloader mysql://root@127.0.0.1/travis postgresql:///travis + echo 'ALTER SEQUENCE llx_accountingaccount_rowid_seq RENAME TO llx_accounting_account_rowid_seq' | psql travis + echo 'ALTER SEQUENCE llx_accounting_account_rowid_seq RESTART WITH 1000001;' | psql travis + #echo 'select * from INFORMATION_SCHEMA.COLUMNS where table_name = 'llx_accountingaccount' | psql travis + #echo 'select * from information_schema.table_constraints;' | psql travis + #echo 'ALTER TABLE "llx_accounting_account" DROP CONSTRAINT "idx_16390_primary"' | psql travis + fi + echo -- | - echo "Upgrading Dolibarr" - # Ensure we catch errors. Set this to +e if you want to go to the end to see log files. - set +e - cd htdocs/install - php upgrade.php 3.5.0 3.6.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade350360.log - php upgrade2.php 3.5.0 3.6.0 > $TRAVIS_BUILD_DIR/upgrade350360-2.log - php step5.php 3.5.0 3.6.0 > $TRAVIS_BUILD_DIR/upgrade350360-3.log - php upgrade.php 3.6.0 3.7.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade360370.log - php upgrade2.php 3.6.0 3.7.0 > $TRAVIS_BUILD_DIR/upgrade360370-2.log - php step5.php 3.6.0 3.7.0 > $TRAVIS_BUILD_DIR/upgrade360370-3.log - php upgrade.php 3.7.0 3.8.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade370380.log - php upgrade2.php 3.7.0 3.8.0 > $TRAVIS_BUILD_DIR/upgrade370380-2.log - php step5.php 3.7.0 3.8.0 > $TRAVIS_BUILD_DIR/upgrade370380-3.log - php upgrade.php 3.8.0 3.9.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade380390.log - php upgrade2.php 3.8.0 3.9.0 > $TRAVIS_BUILD_DIR/upgrade380390-2.log - php step5.php 3.8.0 3.9.0 > $TRAVIS_BUILD_DIR/upgrade380390-3.log - php upgrade.php 3.9.0 4.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade390400.log - php upgrade2.php 3.9.0 4.0.0 > $TRAVIS_BUILD_DIR/upgrade390400-2.log - php step5.php 3.9.0 4.0.0 > $TRAVIS_BUILD_DIR/upgrade390400-3.log - php upgrade.php 4.0.0 5.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade400500.log - php upgrade2.php 4.0.0 5.0.0 > $TRAVIS_BUILD_DIR/upgrade400500-2.log - php step5.php 4.0.0 5.0.0 > $TRAVIS_BUILD_DIR/upgrade400500-3.log - php upgrade.php 5.0.0 6.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade500600.log - php upgrade2.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-2.log - php step5.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-3.log - php upgrade.php 6.0.0 7.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade600700.log - php upgrade2.php 6.0.0 7.0.0 > $TRAVIS_BUILD_DIR/upgrade600700-2.log - php step5.php 6.0.0 7.0.0 > $TRAVIS_BUILD_DIR/upgrade600700-3.log - php upgrade.php 7.0.0 8.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade700800.log - php upgrade2.php 7.0.0 8.0.0 > $TRAVIS_BUILD_DIR/upgrade700800-2.log - php step5.php 7.0.0 8.0.0 > $TRAVIS_BUILD_DIR/upgrade700800-3.log - php upgrade.php 8.0.0 9.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade800900.log - php upgrade2.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-2.log - php step5.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-3.log - php upgrade.php 9.0.0 10.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade9001000.log - php upgrade2.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-2.log - php step5.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-3.log - php upgrade.php 10.0.0 11.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade10001100.log - php upgrade2.php 10.0.0 11.0.0 > $TRAVIS_BUILD_DIR/upgrade10001100-2.log - php step5.php 10.0.0 11.0.0 > $TRAVIS_BUILD_DIR/upgrade10001100-3.log - php upgrade.php 11.0.0 12.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade11001200.log - php upgrade2.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-2.log - php step5.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-3.log - php upgrade.php 12.0.0 13.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade12001300.log - php upgrade2.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-2.log - php step5.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-3.log - php upgrade.php 13.0.0 14.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade13001400.log - php upgrade2.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-2.log - php step5.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-3.log - php upgrade.php 14.0.0 15.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade14001500.log - php upgrade2.php 14.0.0 15.0.0 > $TRAVIS_BUILD_DIR/upgrade14001500-2.log - php step5.php 14.0.0 15.0.0 > $TRAVIS_BUILD_DIR/upgrade14001500-3.log - ls -alrt $TRAVIS_BUILD_DIR/ + - | + echo "Upgrading Dolibarr" + # Ensure we catch errors. Set this to +e if you want to go to the end to see log files. + set +e + cd htdocs/install + php upgrade.php 3.5.0 3.6.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade350360.log + php upgrade2.php 3.5.0 3.6.0 > $TRAVIS_BUILD_DIR/upgrade350360-2.log + php step5.php 3.5.0 3.6.0 > $TRAVIS_BUILD_DIR/upgrade350360-3.log + php upgrade.php 3.6.0 3.7.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade360370.log + php upgrade2.php 3.6.0 3.7.0 > $TRAVIS_BUILD_DIR/upgrade360370-2.log + php step5.php 3.6.0 3.7.0 > $TRAVIS_BUILD_DIR/upgrade360370-3.log + php upgrade.php 3.7.0 3.8.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade370380.log + php upgrade2.php 3.7.0 3.8.0 > $TRAVIS_BUILD_DIR/upgrade370380-2.log + php step5.php 3.7.0 3.8.0 > $TRAVIS_BUILD_DIR/upgrade370380-3.log + php upgrade.php 3.8.0 3.9.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade380390.log + php upgrade2.php 3.8.0 3.9.0 > $TRAVIS_BUILD_DIR/upgrade380390-2.log + php step5.php 3.8.0 3.9.0 > $TRAVIS_BUILD_DIR/upgrade380390-3.log + php upgrade.php 3.9.0 4.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade390400.log + php upgrade2.php 3.9.0 4.0.0 > $TRAVIS_BUILD_DIR/upgrade390400-2.log + php step5.php 3.9.0 4.0.0 > $TRAVIS_BUILD_DIR/upgrade390400-3.log + php upgrade.php 4.0.0 5.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade400500.log + php upgrade2.php 4.0.0 5.0.0 > $TRAVIS_BUILD_DIR/upgrade400500-2.log + php step5.php 4.0.0 5.0.0 > $TRAVIS_BUILD_DIR/upgrade400500-3.log + php upgrade.php 5.0.0 6.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade500600.log + php upgrade2.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-2.log + php step5.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-3.log + php upgrade.php 6.0.0 7.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade600700.log + php upgrade2.php 6.0.0 7.0.0 > $TRAVIS_BUILD_DIR/upgrade600700-2.log + php step5.php 6.0.0 7.0.0 > $TRAVIS_BUILD_DIR/upgrade600700-3.log + php upgrade.php 7.0.0 8.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade700800.log + php upgrade2.php 7.0.0 8.0.0 > $TRAVIS_BUILD_DIR/upgrade700800-2.log + php step5.php 7.0.0 8.0.0 > $TRAVIS_BUILD_DIR/upgrade700800-3.log + php upgrade.php 8.0.0 9.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade800900.log + php upgrade2.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-2.log + php step5.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-3.log + php upgrade.php 9.0.0 10.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade9001000.log + php upgrade2.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-2.log + php step5.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-3.log + php upgrade.php 10.0.0 11.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade10001100.log + php upgrade2.php 10.0.0 11.0.0 > $TRAVIS_BUILD_DIR/upgrade10001100-2.log + php step5.php 10.0.0 11.0.0 > $TRAVIS_BUILD_DIR/upgrade10001100-3.log + php upgrade.php 11.0.0 12.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade11001200.log + php upgrade2.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-2.log + php step5.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-3.log + php upgrade.php 12.0.0 13.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade12001300.log + php upgrade2.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-2.log + php step5.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-3.log + php upgrade.php 13.0.0 14.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade13001400.log + php upgrade2.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-2.log + php step5.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-3.log + php upgrade.php 14.0.0 15.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade14001500.log + php upgrade2.php 14.0.0 15.0.0 > $TRAVIS_BUILD_DIR/upgrade14001500-2.log + php step5.php 14.0.0 15.0.0 > $TRAVIS_BUILD_DIR/upgrade14001500-3.log + ls -alrt $TRAVIS_BUILD_DIR/ -- | - echo "Enabling new modules" - # Enable modules not enabled into original dump - set -e - php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_PRODUCTBATCH,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_STRIPE,MAIN_MODULE_EXPENSEREPORT > $TRAVIS_BUILD_DIR/enablemodule.log - php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKET,MAIN_MODULE_ACCOUNTING,MAIN_MODULE_MRP >> $TRAVIS_BUILD_DIR/enablemodule.log - php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_RECEPTION,MAIN_MODULE_RECRUITMENT >> $TRAVIS_BUILD_DIR/enablemodule.log - php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_KNOWLEDGEMANAGEMENT,MAIN_MODULE_EVENTORGANIZATION,MAIN_MODULE_PARTNERSHIP >> $TRAVIS_BUILD_DIR/enablemodule.log - echo $? - cd - - set +e - echo - #cat /tmp/dolibarr_install.log - cat $TRAVIS_BUILD_DIR/enablemodule.log + - | + echo "Enabling new modules" + # Enable modules not enabled into original dump + set -e + php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_PRODUCTBATCH,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_STRIPE,MAIN_MODULE_EXPENSEREPORT > $TRAVIS_BUILD_DIR/enablemodule.log + php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKET,MAIN_MODULE_ACCOUNTING,MAIN_MODULE_MRP >> $TRAVIS_BUILD_DIR/enablemodule.log + php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_RECEPTION,MAIN_MODULE_RECRUITMENT >> $TRAVIS_BUILD_DIR/enablemodule.log + php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_KNOWLEDGEMANAGEMENT,MAIN_MODULE_EVENTORGANIZATION,MAIN_MODULE_PARTNERSHIP >> $TRAVIS_BUILD_DIR/enablemodule.log + echo $? + cd - + set +e + echo + #cat /tmp/dolibarr_install.log + cat $TRAVIS_BUILD_DIR/enablemodule.log -- | - echo "Unit testing" - # Ensure we catch errors. Set this to +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=$? - echo "Phpunit return code = $phpunitresult" - set +e + - | + echo "Unit testing" + # Ensure we catch errors. Set this to +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=$? + echo "Phpunit return code = $phpunitresult" + set +e after_script: -- | - echo "After script - Output last lines of dolibarr.log" - ls $TRAVIS_BUILD_DIR/documents - #cat $TRAVIS_BUILD_DIR/documents/dolibarr.log - sudo tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log + - | + echo "After script - Output last lines of dolibarr.log" + ls $TRAVIS_BUILD_DIR/documents + #cat $TRAVIS_BUILD_DIR/documents/dolibarr.log + sudo tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log after_success: -- | - echo Success + - | + echo Success after_failure: -- | - echo Failure detected, so we show samples of log to help diagnose - # This part of code is executed only if previous command that fails are enclosed with set +e - # Upgrade log files - for ficlog in `ls $TRAVIS_BUILD_DIR/*.log` - do - echo "Debugging informations for file $ficlog" - #cat $ficlog - done - # Apache log file - echo "Debugging informations for file apache error.log" - sudo cat /var/log/apache2/travis_error_log - if [ "$DEBUG" = true ]; then - # Dolibarr log file - echo "Debugging informations for file dolibarr.log (latest 50 lines)" - tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log - # Database log file - echo "Debugging informations for file mysql error.log" - sudo tail -n 50 /var/log/mysql/error.log - # TODO: PostgreSQL log file - echo - fi + - | + echo Failure detected, so we show samples of log to help diagnose + # This part of code is executed only if previous command that fails are enclosed with set +e + # Upgrade log files + for ficlog in `ls $TRAVIS_BUILD_DIR/*.log` + do + echo "Debugging informations for file $ficlog" + #cat $ficlog + done + # Apache log file + echo "Debugging informations for file apache error.log" + sudo cat /var/log/apache2/travis_error_log + if [ "$DEBUG" = true ]; then + # Dolibarr log file + echo "Debugging informations for file dolibarr.log (latest 50 lines)" + tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log + # Database log file + echo "Debugging informations for file mysql error.log" + sudo tail -n 50 /var/log/mysql/error.log + # TODO: PostgreSQL log file + echo + fi diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php index 39fd87b95a5..bd5ed8ba7ad 100644 --- a/test/phpunit/UserTest.php +++ b/test/phpunit/UserTest.php @@ -281,7 +281,7 @@ class UserTest extends PHPUnit\Framework\TestCase print __METHOD__." id=". $localobject->id ."\n"; //$this->assertNotEquals($user->date_creation, ''); - $user->addrights(0, 'supplier_proposal'); + $localobject->addrights(0, 'supplier_proposal'); $this->assertEquals($localobject->hasRight('member', ''), 0); $this->assertEquals($localobject->hasRight('member', 'member'), 0);$this->assertEquals($localobject->hasRight('product', 'member', 'read'), 0); $this->assertEquals($localobject->hasRight('member', 'member'), 0);$this->assertEquals($localobject->hasRight('produit', 'member', 'read'), 0); From 7f4c7c7e7b1078eb50c844d80866d12baa49a21d Mon Sep 17 00:00:00 2001 From: Quatadah Nasdami Date: Thu, 16 Jun 2022 14:29:30 +0200 Subject: [PATCH 12/12] revert commit in travis yml file --- .travis.yml | 549 ++++++++++++++++++++++++++-------------------------- 1 file changed, 277 insertions(+), 272 deletions(-) diff --git a/.travis.yml b/.travis.yml index da3856b5254..45be1a9a6ba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,30 +14,30 @@ git: # Start on every boot services: - - memcached - - mysql - - postgresql +- memcached +- mysql +- postgresql addons: # Force postgresql to 9.4 (the oldest availablable on xenial) - postgresql: "9.4" + postgresql: '9.4' apt: sources: - # To use the last version of pgloader, we add repo of postgresql with a name available in http://apt.postgresql.org/pub/repos/apt/ - - pgdg-xenial + # To use the last version of pgloader, we add repo of postgresql with a name available in http://apt.postgresql.org/pub/repos/apt/ + - pgdg-xenial packages: - # We need a webserver to test the webservices - # Let's install Apache with. - - apache2 - # mod_php is not supported by Travis. Add fcgi. We install FPM later on. - - libapache2-mod-fastcgi - # We need pgloader for import mysql database into pgsql - - pgloader + # We need a webserver to test the webservices + # Let's install Apache with. + - apache2 + # mod_php is not supported by Travis. Add fcgi. We install FPM later on. + - libapache2-mod-fastcgi + # We need pgloader for import mysql database into pgsql + - pgloader env: global: - # Set to true for very verbose output - - DEBUG=false + # Set to true for very verbose output + - DEBUG=false jobs: fast_finish: true @@ -46,19 +46,19 @@ jobs: include: - stage: PHP 5.6-7.4 if: type = push - php: "5.6" + php: '5.6' env: DB=postgresql - stage: PHP 5.6-7.4 if: type = pull_request OR type = push - php: "7.4.22" + php: '7.4.22' env: DB=mysql - stage: PHP Dev if: type = push AND branch = develop - php: nightly + php: nightly env: DB=mysql - stage: PHP Dev if: type = push AND branch = 15.0 - php: nightly + php: nightly env: DB=mysql notifications: @@ -67,67 +67,69 @@ notifications: on_failure: never # [always|never|change] default: always irc: channels: - - "chat.freenode.net#dolibarr" + - "chat.freenode.net#dolibarr" on_success: change on_failure: always use_notice: true before_install: - - | - echo "Disabling Xdebug for composer" - export PHP_VERSION_NAME=$(phpenv version-name) - cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/xdebug.ini /tmp/xdebug.ini - phpenv config-rm xdebug.ini - echo +- | + echo "Disabling Xdebug for composer" + export PHP_VERSION_NAME=$(phpenv version-name) + cp ~/.phpenv/versions/$PHP_VERSION_NAME/etc/conf.d/xdebug.ini /tmp/xdebug.ini + phpenv config-rm xdebug.ini + echo install: - - | - echo "Updating Composer" - rm $TRAVIS_BUILD_DIR/composer.json - rm $TRAVIS_BUILD_DIR/composer.lock - composer -V - composer self-update - composer -n init - composer -n config vendor-dir htdocs/includes - composer -n config -g vendor-dir htdocs/includes - echo +- | + echo "Updating Composer" + rm $TRAVIS_BUILD_DIR/composer.json + rm $TRAVIS_BUILD_DIR/composer.lock + composer -V + composer self-update + composer -n init + composer -n config vendor-dir htdocs/includes + composer -n config -g vendor-dir htdocs/includes + echo + +- | + echo "Installing Composer dependencies - PHP Unit, Parallel Lint, PHP CodeSniffer - for $TRAVIS_PHP_VERSION" + if [ "$TRAVIS_PHP_VERSION" = '5.6' ]; then + composer -n require phpunit/phpunit ^5 \ + php-parallel-lint/php-parallel-lint ^1 \ + php-parallel-lint/php-console-highlighter ^0 \ + squizlabs/php_codesniffer ^3 + fi + if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ]; then + composer -n require phpunit/phpunit ^6 \ + php-parallel-lint/php-parallel-lint ^1 \ + php-parallel-lint/php-console-highlighter ^0 \ + squizlabs/php_codesniffer ^3 + fi + if [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ] || [ "$TRAVIS_PHP_VERSION" = '7.4.22' ]; then + composer -n require phpunit/phpunit ^7 \ + php-parallel-lint/php-parallel-lint ^1.2 \ + php-parallel-lint/php-console-highlighter ^0 \ + squizlabs/php_codesniffer ^3 + fi + # phpunit 9 is required for php 8 + if [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then + composer -n require --ignore-platform-reqs phpunit/phpunit ^7 \ + php-parallel-lint/php-parallel-lint ^1.2 \ + php-parallel-lint/php-console-highlighter ^0 \ + squizlabs/php_codesniffer ^3 + fi + echo + +- | + echo "Adding path of binaries tools installed by composer to the PATH" + export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$PATH" + echo $PATH + ls $TRAVIS_BUILD_DIR/vendor + ls $TRAVIS_BUILD_DIR/htdocs/includes/bin + echo - - | - echo "Installing Composer dependencies - PHP Unit, Parallel Lint, PHP CodeSniffer - for $TRAVIS_PHP_VERSION" - if [ "$TRAVIS_PHP_VERSION" = '5.6' ]; then - composer -n require phpunit/phpunit ^5 \ - php-parallel-lint/php-parallel-lint ^1 \ - php-parallel-lint/php-console-highlighter ^0 \ - squizlabs/php_codesniffer ^3 - fi - if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ]; then - composer -n require phpunit/phpunit ^6 \ - php-parallel-lint/php-parallel-lint ^1 \ - php-parallel-lint/php-console-highlighter ^0 \ - squizlabs/php_codesniffer ^3 - fi - if [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ] || [ "$TRAVIS_PHP_VERSION" = '7.4.22' ]; then - composer -n require phpunit/phpunit ^7 \ - php-parallel-lint/php-parallel-lint ^1.2 \ - php-parallel-lint/php-console-highlighter ^0 \ - squizlabs/php_codesniffer ^3 - fi - # phpunit 9 is required for php 8 - if [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then - composer -n require --ignore-platform-reqs phpunit/phpunit ^7 \ - php-parallel-lint/php-parallel-lint ^1.2 \ - php-parallel-lint/php-console-highlighter ^0 \ - squizlabs/php_codesniffer ^3 - fi - echo - - | - echo "Adding path of binaries tools installed by composer to the PATH" - export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$PATH" - echo $PATH - ls $TRAVIS_BUILD_DIR/vendor - ls $TRAVIS_BUILD_DIR/htdocs/includes/bin - echo before_script: - | @@ -234,6 +236,7 @@ before_script: echo "***** First line of dolibarr.log" > $TRAVIS_BUILD_DIR/documents/dolibarr.log echo + - echo "Setting up Apache + FPM" # enable php-fpm - sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf @@ -253,219 +256,221 @@ before_script: - sudo cat /etc/apache2/sites-available/000-default.conf - sudo service apache2 restart + + script: - - | - echo "Checking webserver availability by a wget -O - http://127.0.0.1" - # Ensure we stop on error with set -e - set +e - # The wget should return a page with line ' - wget -O - http://127.0.0.1 > test.html - head test.html - sudo cat /var/log/apache2/travis_error_log - set +e - echo +- | + echo "Checking webserver availability by a wget -O - http://127.0.0.1" + # Ensure we stop on error with set -e + set +e + # The wget should return a page with line ' + wget -O - http://127.0.0.1 > test.html + head test.html + sudo cat /var/log/apache2/travis_error_log + set +e + echo - - | - echo "Checking PHP syntax errors (only 1 version to not overload travis and avoid duplicate tests)" - # Ensure we catch errors - set -e - #parallel-lint --exclude htdocs/includes --blame . - # Exclusions are defined in the ruleset.xml file - if [ "$TRAVIS_PHP_VERSION" = "7.4.22" ]; then - parallel-lint -e php --exclude dev/tools/test/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes \ - --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian \ - --exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/php-parallel-lint --exclude htdocs/includes/symfony \ - --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/maximebf \ - --exclude htdocs/includes/phpunit/ --exclude htdocs/includes/tecnickcom/tcpdf/include/barcodes --exclude htdocs/includes/webmozart --blame . - fi - set +e - echo +- | + echo "Checking PHP syntax errors (only 1 version to not overload travis and avoid duplicate tests)" + # Ensure we catch errors + set -e + #parallel-lint --exclude htdocs/includes --blame . + # Exclusions are defined in the ruleset.xml file + if [ "$TRAVIS_PHP_VERSION" = "7.4.22" ]; then + parallel-lint -e php --exclude dev/tools/test/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes \ + --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian \ + --exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/php-parallel-lint --exclude htdocs/includes/symfony \ + --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/maximebf \ + --exclude htdocs/includes/phpunit/ --exclude htdocs/includes/tecnickcom/tcpdf/include/barcodes --exclude htdocs/includes/webmozart --blame . + fi + set +e + echo - - | - echo "Checking coding style (only for Pull Requests builds and 1 version to not overload travis and avoid duplicate tests)" - # Ensure we catch errors - set -e - # Exclusions are defined in the ruleset.xml file - if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "7.4.22" ]; then - phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; - fi - set +e - echo +- | + echo "Checking coding style (only for Pull Requests builds and 1 version to not overload travis and avoid duplicate tests)" + # Ensure we catch errors + set -e + # Exclusions are defined in the ruleset.xml file + if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "7.4.22" ]; then + phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; + fi + set +e + echo - - | - export INSTALL_FORCED_FILE=htdocs/install/install.forced.php - echo "Setting up Dolibarr $INSTALL_FORCED_FILE to test installation" - # Ensure we catch errors - set +e - echo ' $INSTALL_FORCED_FILE - echo '$'force_install_noedit=2';' >> $INSTALL_FORCED_FILE - if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ]; then - echo '$'force_install_type=\'mysqli\'';' >> $INSTALL_FORCED_FILE - fi - if [ "$DB" = 'postgresql' ]; then - echo '$'force_install_type=\'pgsql\'';' >> $INSTALL_FORCED_FILE - fi - echo '$'force_install_dbserver=\'127.0.0.1\'';' >> $INSTALL_FORCED_FILE - echo '$'force_install_database=\'travis\'';' >> $INSTALL_FORCED_FILE - echo '$'force_install_databaselogin=\'travis\'';' >> $INSTALL_FORCED_FILE - echo '$'force_install_databasepass=\'\'';' >> $INSTALL_FORCED_FILE - echo '$'force_install_port=\'5432\'';' >> $INSTALL_FORCED_FILE - echo '$'force_install_prefix=\'llx_\'';' >> $INSTALL_FORCED_FILE - echo '$'force_install_createdatabase=false';' >> $INSTALL_FORCED_FILE - echo '$'force_install_createuser=false';' >> $INSTALL_FORCED_FILE - echo '$'force_install_mainforcehttps=false';' >> $INSTALL_FORCED_FILE - echo '$'force_install_main_data_root=\'$TRAVIS_BUILD_DIR/htdocs\'';' >> $INSTALL_FORCED_FILE - #cat $INSTALL_FORCED_FILE +- | + export INSTALL_FORCED_FILE=htdocs/install/install.forced.php + echo "Setting up Dolibarr $INSTALL_FORCED_FILE to test installation" + # Ensure we catch errors + set +e + echo ' $INSTALL_FORCED_FILE + echo '$'force_install_noedit=2';' >> $INSTALL_FORCED_FILE + if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ]; then + echo '$'force_install_type=\'mysqli\'';' >> $INSTALL_FORCED_FILE + fi + if [ "$DB" = 'postgresql' ]; then + echo '$'force_install_type=\'pgsql\'';' >> $INSTALL_FORCED_FILE + fi + echo '$'force_install_dbserver=\'127.0.0.1\'';' >> $INSTALL_FORCED_FILE + echo '$'force_install_database=\'travis\'';' >> $INSTALL_FORCED_FILE + echo '$'force_install_databaselogin=\'travis\'';' >> $INSTALL_FORCED_FILE + echo '$'force_install_databasepass=\'\'';' >> $INSTALL_FORCED_FILE + echo '$'force_install_port=\'5432\'';' >> $INSTALL_FORCED_FILE + echo '$'force_install_prefix=\'llx_\'';' >> $INSTALL_FORCED_FILE + echo '$'force_install_createdatabase=false';' >> $INSTALL_FORCED_FILE + echo '$'force_install_createuser=false';' >> $INSTALL_FORCED_FILE + echo '$'force_install_mainforcehttps=false';' >> $INSTALL_FORCED_FILE + echo '$'force_install_main_data_root=\'$TRAVIS_BUILD_DIR/htdocs\'';' >> $INSTALL_FORCED_FILE + #cat $INSTALL_FORCED_FILE - #- | - # echo "Installing Dolibarr" - # cd htdocs/install - # php step1.php $TRAVIS_BUILD_DIR/htdocs > $TRAVIS_BUILD_DIR/install.log - # php step2.php set >> $TRAVIS_BUILD_DIR/install.log - # if [ "$?" -ne "0" ]; then - # echo "SORRY, AN ERROR OCCURED DURING INSTALLATION PROCESS" - # cat $TRAVIS_BUILD_DIR/install.log - # exit 1 - # fi - # cd ../.. - # rm $INSTALL_FORCED_FILE - # #cat $TRAVIS_BUILD_DIR/install.log - # set +e - # echo +#- | +# echo "Installing Dolibarr" +# cd htdocs/install +# php step1.php $TRAVIS_BUILD_DIR/htdocs > $TRAVIS_BUILD_DIR/install.log +# php step2.php set >> $TRAVIS_BUILD_DIR/install.log +# if [ "$?" -ne "0" ]; then +# echo "SORRY, AN ERROR OCCURED DURING INSTALLATION PROCESS" +# cat $TRAVIS_BUILD_DIR/install.log +# exit 1 +# fi +# cd ../.. +# rm $INSTALL_FORCED_FILE +# #cat $TRAVIS_BUILD_DIR/install.log +# set +e +# echo - - | - echo "Setting up database to test migrations" - if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ] || [ "$DB" = 'postgresql' ]; then - echo "MySQL" - mysql -e 'DROP DATABASE IF EXISTS travis;' - mysql -e 'CREATE DATABASE IF NOT EXISTS travis;' - mysql -e 'GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1;' - mysql -e 'FLUSH PRIVILEGES;' - mysql -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql - fi - if [ "$DB" = 'postgresql' ]; then - #pgsql travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql - #pgloader mysql://root:pass@127.0.0.1/base postgresql://dolibarrowner@127.0.0.1/dolibarr - echo pgloader mysql://root@127.0.0.1/travis postgresql:///travis - pgloader mysql://root@127.0.0.1/travis postgresql:///travis - echo 'ALTER SEQUENCE llx_accountingaccount_rowid_seq RENAME TO llx_accounting_account_rowid_seq' | psql travis - echo 'ALTER SEQUENCE llx_accounting_account_rowid_seq RESTART WITH 1000001;' | psql travis - #echo 'select * from INFORMATION_SCHEMA.COLUMNS where table_name = 'llx_accountingaccount' | psql travis - #echo 'select * from information_schema.table_constraints;' | psql travis - #echo 'ALTER TABLE "llx_accounting_account" DROP CONSTRAINT "idx_16390_primary"' | psql travis - fi - echo +- | + echo "Setting up database to test migrations" + if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ] || [ "$DB" = 'postgresql' ]; then + echo "MySQL" + mysql -e 'DROP DATABASE IF EXISTS travis;' + mysql -e 'CREATE DATABASE IF NOT EXISTS travis;' + mysql -e 'GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1;' + mysql -e 'FLUSH PRIVILEGES;' + mysql -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql + fi + if [ "$DB" = 'postgresql' ]; then + #pgsql travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql + #pgloader mysql://root:pass@127.0.0.1/base postgresql://dolibarrowner@127.0.0.1/dolibarr + echo pgloader mysql://root@127.0.0.1/travis postgresql:///travis + pgloader mysql://root@127.0.0.1/travis postgresql:///travis + echo 'ALTER SEQUENCE llx_accountingaccount_rowid_seq RENAME TO llx_accounting_account_rowid_seq' | psql travis + echo 'ALTER SEQUENCE llx_accounting_account_rowid_seq RESTART WITH 1000001;' | psql travis + #echo 'select * from INFORMATION_SCHEMA.COLUMNS where table_name = 'llx_accountingaccount' | psql travis + #echo 'select * from information_schema.table_constraints;' | psql travis + #echo 'ALTER TABLE "llx_accounting_account" DROP CONSTRAINT "idx_16390_primary"' | psql travis + fi + echo - - | - echo "Upgrading Dolibarr" - # Ensure we catch errors. Set this to +e if you want to go to the end to see log files. - set +e - cd htdocs/install - php upgrade.php 3.5.0 3.6.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade350360.log - php upgrade2.php 3.5.0 3.6.0 > $TRAVIS_BUILD_DIR/upgrade350360-2.log - php step5.php 3.5.0 3.6.0 > $TRAVIS_BUILD_DIR/upgrade350360-3.log - php upgrade.php 3.6.0 3.7.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade360370.log - php upgrade2.php 3.6.0 3.7.0 > $TRAVIS_BUILD_DIR/upgrade360370-2.log - php step5.php 3.6.0 3.7.0 > $TRAVIS_BUILD_DIR/upgrade360370-3.log - php upgrade.php 3.7.0 3.8.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade370380.log - php upgrade2.php 3.7.0 3.8.0 > $TRAVIS_BUILD_DIR/upgrade370380-2.log - php step5.php 3.7.0 3.8.0 > $TRAVIS_BUILD_DIR/upgrade370380-3.log - php upgrade.php 3.8.0 3.9.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade380390.log - php upgrade2.php 3.8.0 3.9.0 > $TRAVIS_BUILD_DIR/upgrade380390-2.log - php step5.php 3.8.0 3.9.0 > $TRAVIS_BUILD_DIR/upgrade380390-3.log - php upgrade.php 3.9.0 4.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade390400.log - php upgrade2.php 3.9.0 4.0.0 > $TRAVIS_BUILD_DIR/upgrade390400-2.log - php step5.php 3.9.0 4.0.0 > $TRAVIS_BUILD_DIR/upgrade390400-3.log - php upgrade.php 4.0.0 5.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade400500.log - php upgrade2.php 4.0.0 5.0.0 > $TRAVIS_BUILD_DIR/upgrade400500-2.log - php step5.php 4.0.0 5.0.0 > $TRAVIS_BUILD_DIR/upgrade400500-3.log - php upgrade.php 5.0.0 6.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade500600.log - php upgrade2.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-2.log - php step5.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-3.log - php upgrade.php 6.0.0 7.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade600700.log - php upgrade2.php 6.0.0 7.0.0 > $TRAVIS_BUILD_DIR/upgrade600700-2.log - php step5.php 6.0.0 7.0.0 > $TRAVIS_BUILD_DIR/upgrade600700-3.log - php upgrade.php 7.0.0 8.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade700800.log - php upgrade2.php 7.0.0 8.0.0 > $TRAVIS_BUILD_DIR/upgrade700800-2.log - php step5.php 7.0.0 8.0.0 > $TRAVIS_BUILD_DIR/upgrade700800-3.log - php upgrade.php 8.0.0 9.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade800900.log - php upgrade2.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-2.log - php step5.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-3.log - php upgrade.php 9.0.0 10.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade9001000.log - php upgrade2.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-2.log - php step5.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-3.log - php upgrade.php 10.0.0 11.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade10001100.log - php upgrade2.php 10.0.0 11.0.0 > $TRAVIS_BUILD_DIR/upgrade10001100-2.log - php step5.php 10.0.0 11.0.0 > $TRAVIS_BUILD_DIR/upgrade10001100-3.log - php upgrade.php 11.0.0 12.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade11001200.log - php upgrade2.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-2.log - php step5.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-3.log - php upgrade.php 12.0.0 13.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade12001300.log - php upgrade2.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-2.log - php step5.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-3.log - php upgrade.php 13.0.0 14.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade13001400.log - php upgrade2.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-2.log - php step5.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-3.log - php upgrade.php 14.0.0 15.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade14001500.log - php upgrade2.php 14.0.0 15.0.0 > $TRAVIS_BUILD_DIR/upgrade14001500-2.log - php step5.php 14.0.0 15.0.0 > $TRAVIS_BUILD_DIR/upgrade14001500-3.log - ls -alrt $TRAVIS_BUILD_DIR/ +- | + echo "Upgrading Dolibarr" + # Ensure we catch errors. Set this to +e if you want to go to the end to see log files. + set +e + cd htdocs/install + php upgrade.php 3.5.0 3.6.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade350360.log + php upgrade2.php 3.5.0 3.6.0 > $TRAVIS_BUILD_DIR/upgrade350360-2.log + php step5.php 3.5.0 3.6.0 > $TRAVIS_BUILD_DIR/upgrade350360-3.log + php upgrade.php 3.6.0 3.7.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade360370.log + php upgrade2.php 3.6.0 3.7.0 > $TRAVIS_BUILD_DIR/upgrade360370-2.log + php step5.php 3.6.0 3.7.0 > $TRAVIS_BUILD_DIR/upgrade360370-3.log + php upgrade.php 3.7.0 3.8.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade370380.log + php upgrade2.php 3.7.0 3.8.0 > $TRAVIS_BUILD_DIR/upgrade370380-2.log + php step5.php 3.7.0 3.8.0 > $TRAVIS_BUILD_DIR/upgrade370380-3.log + php upgrade.php 3.8.0 3.9.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade380390.log + php upgrade2.php 3.8.0 3.9.0 > $TRAVIS_BUILD_DIR/upgrade380390-2.log + php step5.php 3.8.0 3.9.0 > $TRAVIS_BUILD_DIR/upgrade380390-3.log + php upgrade.php 3.9.0 4.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade390400.log + php upgrade2.php 3.9.0 4.0.0 > $TRAVIS_BUILD_DIR/upgrade390400-2.log + php step5.php 3.9.0 4.0.0 > $TRAVIS_BUILD_DIR/upgrade390400-3.log + php upgrade.php 4.0.0 5.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade400500.log + php upgrade2.php 4.0.0 5.0.0 > $TRAVIS_BUILD_DIR/upgrade400500-2.log + php step5.php 4.0.0 5.0.0 > $TRAVIS_BUILD_DIR/upgrade400500-3.log + php upgrade.php 5.0.0 6.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade500600.log + php upgrade2.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-2.log + php step5.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-3.log + php upgrade.php 6.0.0 7.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade600700.log + php upgrade2.php 6.0.0 7.0.0 > $TRAVIS_BUILD_DIR/upgrade600700-2.log + php step5.php 6.0.0 7.0.0 > $TRAVIS_BUILD_DIR/upgrade600700-3.log + php upgrade.php 7.0.0 8.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade700800.log + php upgrade2.php 7.0.0 8.0.0 > $TRAVIS_BUILD_DIR/upgrade700800-2.log + php step5.php 7.0.0 8.0.0 > $TRAVIS_BUILD_DIR/upgrade700800-3.log + php upgrade.php 8.0.0 9.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade800900.log + php upgrade2.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-2.log + php step5.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-3.log + php upgrade.php 9.0.0 10.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade9001000.log + php upgrade2.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-2.log + php step5.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-3.log + php upgrade.php 10.0.0 11.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade10001100.log + php upgrade2.php 10.0.0 11.0.0 > $TRAVIS_BUILD_DIR/upgrade10001100-2.log + php step5.php 10.0.0 11.0.0 > $TRAVIS_BUILD_DIR/upgrade10001100-3.log + php upgrade.php 11.0.0 12.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade11001200.log + php upgrade2.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-2.log + php step5.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-3.log + php upgrade.php 12.0.0 13.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade12001300.log + php upgrade2.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-2.log + php step5.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-3.log + php upgrade.php 13.0.0 14.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade13001400.log + php upgrade2.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-2.log + php step5.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-3.log + php upgrade.php 14.0.0 15.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade14001500.log + php upgrade2.php 14.0.0 15.0.0 > $TRAVIS_BUILD_DIR/upgrade14001500-2.log + php step5.php 14.0.0 15.0.0 > $TRAVIS_BUILD_DIR/upgrade14001500-3.log + ls -alrt $TRAVIS_BUILD_DIR/ - - | - echo "Enabling new modules" - # Enable modules not enabled into original dump - set -e - php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_PRODUCTBATCH,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_STRIPE,MAIN_MODULE_EXPENSEREPORT > $TRAVIS_BUILD_DIR/enablemodule.log - php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKET,MAIN_MODULE_ACCOUNTING,MAIN_MODULE_MRP >> $TRAVIS_BUILD_DIR/enablemodule.log - php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_RECEPTION,MAIN_MODULE_RECRUITMENT >> $TRAVIS_BUILD_DIR/enablemodule.log - php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_KNOWLEDGEMANAGEMENT,MAIN_MODULE_EVENTORGANIZATION,MAIN_MODULE_PARTNERSHIP >> $TRAVIS_BUILD_DIR/enablemodule.log - echo $? - cd - - set +e - echo - #cat /tmp/dolibarr_install.log - cat $TRAVIS_BUILD_DIR/enablemodule.log +- | + echo "Enabling new modules" + # Enable modules not enabled into original dump + set -e + php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_PRODUCTBATCH,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_STRIPE,MAIN_MODULE_EXPENSEREPORT > $TRAVIS_BUILD_DIR/enablemodule.log + php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKET,MAIN_MODULE_ACCOUNTING,MAIN_MODULE_MRP >> $TRAVIS_BUILD_DIR/enablemodule.log + php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_RECEPTION,MAIN_MODULE_RECRUITMENT >> $TRAVIS_BUILD_DIR/enablemodule.log + php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_KNOWLEDGEMANAGEMENT,MAIN_MODULE_EVENTORGANIZATION,MAIN_MODULE_PARTNERSHIP >> $TRAVIS_BUILD_DIR/enablemodule.log + echo $? + cd - + set +e + echo + #cat /tmp/dolibarr_install.log + cat $TRAVIS_BUILD_DIR/enablemodule.log - - | - echo "Unit testing" - # Ensure we catch errors. Set this to +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=$? - echo "Phpunit return code = $phpunitresult" - set +e +- | + echo "Unit testing" + # Ensure we catch errors. Set this to +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=$? + echo "Phpunit return code = $phpunitresult" + set +e after_script: - - | - echo "After script - Output last lines of dolibarr.log" - ls $TRAVIS_BUILD_DIR/documents - #cat $TRAVIS_BUILD_DIR/documents/dolibarr.log - sudo tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log +- | + echo "After script - Output last lines of dolibarr.log" + ls $TRAVIS_BUILD_DIR/documents + #cat $TRAVIS_BUILD_DIR/documents/dolibarr.log + sudo tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log after_success: - - | - echo Success +- | + echo Success after_failure: - - | - echo Failure detected, so we show samples of log to help diagnose - # This part of code is executed only if previous command that fails are enclosed with set +e - # Upgrade log files - for ficlog in `ls $TRAVIS_BUILD_DIR/*.log` - do - echo "Debugging informations for file $ficlog" - #cat $ficlog - done - # Apache log file - echo "Debugging informations for file apache error.log" - sudo cat /var/log/apache2/travis_error_log - if [ "$DEBUG" = true ]; then - # Dolibarr log file - echo "Debugging informations for file dolibarr.log (latest 50 lines)" - tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log - # Database log file - echo "Debugging informations for file mysql error.log" - sudo tail -n 50 /var/log/mysql/error.log - # TODO: PostgreSQL log file - echo - fi +- | + echo Failure detected, so we show samples of log to help diagnose + # This part of code is executed only if previous command that fails are enclosed with set +e + # Upgrade log files + for ficlog in `ls $TRAVIS_BUILD_DIR/*.log` + do + echo "Debugging informations for file $ficlog" + #cat $ficlog + done + # Apache log file + echo "Debugging informations for file apache error.log" + sudo cat /var/log/apache2/travis_error_log + if [ "$DEBUG" = true ]; then + # Dolibarr log file + echo "Debugging informations for file dolibarr.log (latest 50 lines)" + tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log + # Database log file + echo "Debugging informations for file mysql error.log" + sudo tail -n 50 /var/log/mysql/error.log + # TODO: PostgreSQL log file + echo + fi