From 22921ad26b37644a4055458dcf8f437a7c189735 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Apr 2015 04:43:28 +0200 Subject: [PATCH] Fix phpunit --- htdocs/install/mysql/migration/3.7.0-3.8.0.sql | 1 + test/phpunit/AdherentTest.php | 11 +++++------ test/phpunit/AdminLibTest.php | 17 +++++++++++++++++ test/phpunit/AllTests.php | 3 +++ test/phpunit/BuildDocTest.php | 4 ---- 5 files changed, 26 insertions(+), 10 deletions(-) diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index 947d80af51c..9fe95226b84 100644 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -535,5 +535,6 @@ CREATE TABLE IF NOT EXISTS llx_propal_merge_pdf_product ( -- Feature request: A page to merge two thirdparties into one #2613 ALTER TABLE llx_categorie_societe CHANGE COLUMN fk_societe fk_soc INTEGER NOT NULL; +ALTER TABLE llx_categorie_fournisseur CHANGE COLUMN fk_societe fk_soc INTEGER NOT NULL; ALTER TABLE llx_societe CHANGE COLUMN fk_societe fk_soc INTEGER NOT NULL; ALTER TABLE llx_user CHANGE COLUMN fk_societe fk_soc INTEGER NOT NULL; diff --git a/test/phpunit/AdherentTest.php b/test/phpunit/AdherentTest.php index 334e42eb5f9..01424d81796 100644 --- a/test/phpunit/AdherentTest.php +++ b/test/phpunit/AdherentTest.php @@ -263,12 +263,12 @@ class AdherentTest extends PHPUnit_Framework_TestCase $result=$localobject->update($user); print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0); - $result=$localobject->update_note($localobject->note); + $result=$localobject->update_note($localobject->note,'_private'); + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0); + $result=$localobject->update_note_public($localobject->note,'_public'); print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0); - //$result=$localobject->update_note_public($localobject->note_public); - //print __METHOD__." id=".$localobject->id." result=".$result."\n"; - //$this->assertLessThan($result, 0); $newobject=new Adherent($this->savdb); $result=$newobject->fetch($localobject->id); @@ -278,8 +278,7 @@ class AdherentTest extends PHPUnit_Framework_TestCase $this->assertEquals($localobject->civility_id, $newobject->civility_id); $this->assertEquals($localobject->login, $newobject->login); $this->assertEquals($localobject->societe, $newobject->societe); - $this->assertEquals($localobject->note, $newobject->note); - //$this->assertEquals($localobject->note_public, $newobject->note_public); + $this->assertEquals($localobject->note_public, $newobject->note_public); $this->assertEquals($localobject->lastname, $newobject->lastname); $this->assertEquals($localobject->firstname, $newobject->firstname); $this->assertEquals($localobject->address, $newobject->address); diff --git a/test/phpunit/AdminLibTest.php b/test/phpunit/AdminLibTest.php index bef0c2eff9d..d7f3d17a583 100644 --- a/test/phpunit/AdminLibTest.php +++ b/test/phpunit/AdminLibTest.php @@ -142,4 +142,21 @@ class AdminLibTest extends PHPUnit_Framework_TestCase return $result; } + + /** + * testEnableModule + * + * @return void + */ + public function testEnableModule() + { + global $conf, $db, $langs, $user; + + require_once dirname(__FILE__).'/../../htdocs/core/modules/modExpenseReport.class.php'; + print "Enable module modExpenseReport"; + $moduledescriptor=new modExpenseReport($db); + $moduledescriptor->init(); + $conf->setValues($db); + } + } diff --git a/test/phpunit/AllTests.php b/test/phpunit/AllTests.php index b4c7497cb79..2c56ff7db44 100644 --- a/test/phpunit/AllTests.php +++ b/test/phpunit/AllTests.php @@ -31,6 +31,8 @@ global $conf,$user,$langs,$db; //require_once 'PHPUnit/Autoload.php'; require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; + + if ($langs->defaultlang != 'en_US') { print "Error: Default language for company to run tests must be set to en_US or auto. Current is ".$langs->defaultlang."\n"; @@ -61,6 +63,7 @@ class AllTests */ public static function suite() { + $suite = new PHPUnit_Framework_TestSuite('PHPUnit Framework'); //require_once dirname(__FILE__).'/CoreTest.php'; diff --git a/test/phpunit/BuildDocTest.php b/test/phpunit/BuildDocTest.php index 443310c10d3..25b7bd15c03 100644 --- a/test/phpunit/BuildDocTest.php +++ b/test/phpunit/BuildDocTest.php @@ -106,10 +106,6 @@ class BuildDocTest extends PHPUnit_Framework_TestCase { global $conf,$user,$langs,$db; - print "Enable module modExpenseReport"; - $moduledescriptor=new modExpenseReport($db); - $moduledescriptor->init(); - if (! $conf->facture->enabled) { print __METHOD__." invoice module not enabled\n"; die(); } if (! $conf->commande->enabled) { print __METHOD__." order module not enabled\n"; die(); } if (! $conf->propal->enabled) { print __METHOD__." propal module not enabled\n"; die(); }