diff --git a/test/phpunit/AdherentTest.php b/test/phpunit/AdherentTest.php index 286be96a8fc6e1cb0f7bb44f551c1e0c497e5e72..9575f1e88a33f9dfdeed34a41c8c692f75d80473 100644 --- a/test/phpunit/AdherentTest.php +++ b/test/phpunit/AdherentTest.php @@ -114,6 +114,9 @@ class AdherentTest extends PHPUnit_Framework_TestCase } /** + * testAdherentCreate + * + * @return void */ public function testAdherentCreate() { @@ -133,6 +136,11 @@ class AdherentTest extends PHPUnit_Framework_TestCase } /** + * testAdherentFetch + * + * @param int $id Id of object to fecth + * @return object Fetched object + * * @depends testAdherentCreate * The depends says test is run only if previous is ok */ @@ -153,6 +161,11 @@ class AdherentTest extends PHPUnit_Framework_TestCase } /** + * testAdherentUpdate + * + * @param Adherent $localobject Member instance + * @return Adherent + * * @depends testAdherentFetch * The depends says test is run only if previous is ok */ @@ -215,6 +228,11 @@ class AdherentTest extends PHPUnit_Framework_TestCase } /** + * testAdherentValid + * + * @param Adherent $localobject Member instance + * @return Adherent + * * @depends testAdherentUpdate * The depends says test is run only if previous is ok */ @@ -234,6 +252,11 @@ class AdherentTest extends PHPUnit_Framework_TestCase } /** + * testAdherentOther + * + * @param Adherent $localobject Member instance + * @return int Id of object + * * @depends testAdherentValid * The depends says test is run only if previous is ok */ @@ -258,6 +281,11 @@ class AdherentTest extends PHPUnit_Framework_TestCase } /** + * testAdherentDelete + * + * @param int $id Id of object to delete + * @return void + * * @depends testAdherentOther * The depends says test is run only if previous is ok */ @@ -278,24 +306,5 @@ class AdherentTest extends PHPUnit_Framework_TestCase return $result; } - /** - * - */ - /*public function testVerifyNumRef() - { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; - - $localobject=new Adherent($this->savdb); - $result=$localobject->ref='refthatdoesnotexists'; - $result=$localobject->VerifyNumRef(); - print __METHOD__." result=".$result."\n"; - $this->assertEquals($result, 0); - - return $result; - }*/ } ?> \ No newline at end of file diff --git a/test/phpunit/BuildDocTest.php b/test/phpunit/BuildDocTest.php index b0977142f33dde58f72abc0a329dd7018735141b..5e44df5fea449ec9e12ccd68485a155f5a3a0e16 100644 --- a/test/phpunit/BuildDocTest.php +++ b/test/phpunit/BuildDocTest.php @@ -29,12 +29,15 @@ global $conf,$user,$langs,$db; require_once 'PHPUnit/Autoload.php'; require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; require_once dirname(__FILE__).'/../../htdocs/compta/facture/class/facture.class.php'; +require_once dirname(__FILE__).'/../../htdocs/fourn/class/fournisseur.facture.class.php'; require_once dirname(__FILE__).'/../../htdocs/commande/class/commande.class.php'; +require_once dirname(__FILE__).'/../../htdocs/fourn/class/fournisseur.commande.class.php'; require_once dirname(__FILE__).'/../../htdocs/comm/propal/class/propal.class.php'; require_once dirname(__FILE__).'/../../htdocs/fichinter/class/fichinter.class.php'; require_once dirname(__FILE__).'/../../htdocs/expedition/class/expedition.class.php'; require_once dirname(__FILE__).'/../../htdocs/projet/class/project.class.php'; require_once dirname(__FILE__).'/../../htdocs/projet/class/task.class.php'; +require_once dirname(__FILE__).'/../../htdocs/fourn/class/fournisseur.product.class.php'; require_once dirname(__FILE__).'/../../htdocs/core/lib/pdf.lib.php'; require_once dirname(__FILE__).'/../../htdocs/core/modules/facture/doc/pdf_crabe.modules.php'; require_once dirname(__FILE__).'/../../htdocs/core/modules/facture/doc/pdf_oursin.modules.php'; @@ -48,7 +51,9 @@ require_once dirname(__FILE__).'/../../htdocs/core/modules/expedition/doc/pdf_ex require_once dirname(__FILE__).'/../../htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php'; // Mother classes of pdf generators require_once dirname(__FILE__).'/../../htdocs/core/modules/facture/modules_facture.php'; +require_once dirname(__FILE__).'/../../htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php'; require_once dirname(__FILE__).'/../../htdocs/core/modules/commande/modules_commande.php'; +require_once dirname(__FILE__).'/../../htdocs/core/modules/supplier_order/modules_commandefournisseur.php'; require_once dirname(__FILE__).'/../../htdocs/core/modules/propale/modules_propale.php'; require_once dirname(__FILE__).'/../../htdocs/core/modules/project/modules_project.php'; require_once dirname(__FILE__).'/../../htdocs/core/modules/fichinter/modules_fichinter.php'; @@ -146,6 +151,9 @@ class BuildDocTest extends PHPUnit_Framework_TestCase } /** + * testFactureBuild + * + * @return int */ public function testFactureBuild() { @@ -178,6 +186,37 @@ class BuildDocTest extends PHPUnit_Framework_TestCase } /** + * testFactureBuild + * + * @return int + */ + public function testFactureFournisseurBuild() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $conf->fournisseur->facture->dir_output.='/temp'; + $localobject=new FactureFournisseur($this->savdb); + $localobject->initAsSpecimen(); + $localobject->socid=1; + + // Canelle + $localobject->modelpdf='canelle'; + $result=supplier_invoice_pdf_create($db, $localobject, $localobject->modelpdf, $langs); + + $this->assertLessThan($result, 0); + print __METHOD__." result=".$result."\n"; + + return 0; + } + + /** + * testCommandeBuild + * + * @return int */ public function testCommandeBuild() { @@ -209,7 +248,39 @@ class BuildDocTest extends PHPUnit_Framework_TestCase return 0; } + + /** + * testCommandeFournisseurBuild + * + * @return int + */ + public function testCommandeFournisseurBuild() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $conf->fournisseur->commande->dir_output.='/temp'; + $localobject=new CommandeFournisseur($this->savdb); + $localobject->initAsSpecimen(); + $localobject->socid=1; + + // Muscadet + $localobject->modelpdf='muscadet'; + $result=supplier_order_pdf_create($db, $localobject, $localobject->modelpdf, $langs); + + $this->assertLessThan($result, 0); + print __METHOD__." result=".$result."\n"; + + return 0; + } + /** + * testPropalBuild + * + * @return int */ public function testPropalBuild() { @@ -242,6 +313,9 @@ class BuildDocTest extends PHPUnit_Framework_TestCase } /** + * testProjectBuild + * + * @return int */ public function testProjectBuild() { @@ -267,6 +341,9 @@ class BuildDocTest extends PHPUnit_Framework_TestCase } /** + * testFichinterBuild + * + * @return int */ public function testFichinterBuild() { @@ -292,6 +369,9 @@ class BuildDocTest extends PHPUnit_Framework_TestCase } /** + * testExpeditionBuild + * + * @return int */ public function testExpeditionBuild() { diff --git a/test/phpunit/CMailFileTest.php b/test/phpunit/CMailFileTest.php index f7bf4791f7ac737486adbe3c9c7c94ff69a989fc..8e28276bfb8ea30ae4176be2980a2cfe2f7e153b 100755 --- a/test/phpunit/CMailFileTest.php +++ b/test/phpunit/CMailFileTest.php @@ -114,6 +114,9 @@ class CMailFileTest extends PHPUnit_Framework_TestCase } /** + * testCMailFileText + * + * @return void */ public function testCMailFileText() { @@ -134,6 +137,9 @@ class CMailFileTest extends PHPUnit_Framework_TestCase } /** + * testCMailFileStatic + * + * @return string */ public function testCMailFileStatic() { diff --git a/test/phpunit/CategorieTest.php b/test/phpunit/CategorieTest.php index a5634084c853bfde2879f9a14610f0f244c8ffa8..24693fdac20eeb88b87a3d0fcb3139fe40bf28ae 100755 --- a/test/phpunit/CategorieTest.php +++ b/test/phpunit/CategorieTest.php @@ -115,6 +115,9 @@ class CategorieTest extends PHPUnit_Framework_TestCase } /** + * testCategorieCreate + * + * @return int */ public function testCategorieCreate() { @@ -138,6 +141,11 @@ class CategorieTest extends PHPUnit_Framework_TestCase } /** + * testCategorieProduct + * + * @param int $id Id of category + * @return int + * * @depends testCategorieCreate * The depends says test is run only if previous is ok */ @@ -173,6 +181,11 @@ class CategorieTest extends PHPUnit_Framework_TestCase } /** + * testCategorieFetch + * + * @param int $id Id of category + * @return int + * * @depends testCategorieProduct * The depends says test is run only if previous is ok */ @@ -193,6 +206,11 @@ class CategorieTest extends PHPUnit_Framework_TestCase } /** + * testCategorieUpdate + * + * @param Category $localobject Category + * @return int + * @depends testCategorieFetch * The depends says test is run only if previous is ok */ @@ -213,25 +231,11 @@ class CategorieTest extends PHPUnit_Framework_TestCase } /** - * @depends testCategorieUpdate - * The depends says test is run only if previous is ok - */ - /*public function testCategorieXXX($localobject) - { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; - - $result=$localobject->delete(0); - print __METHOD__." id=".$localobject->id." result=".$result."\n"; - - $this->assertLessThan($result, 0); - return $localobject; - }*/ - - /** + * testCategorieOther + * + * @param Category $localobject Category + * @return int + * * @depends testCategorieUpdate * The depends says test is run only if previous is ok */ @@ -262,6 +266,11 @@ class CategorieTest extends PHPUnit_Framework_TestCase } /** + * testCategorieDelete + * + * @param int $id Id of category + * @return int + * * @depends testCategorieOther * The depends says test is run only if previous is ok */ @@ -283,6 +292,10 @@ class CategorieTest extends PHPUnit_Framework_TestCase } /** + * testCategorieStatic + * + * @return void + * * @depends testCategorieDelete */ public function testCategorieStatic() diff --git a/test/phpunit/CommonObjectTest.php b/test/phpunit/CommonObjectTest.php index cae50abe534a4036c0f7c9b41bb69f0ac93c7beb..42f5503e1524f4beaa63acf69df516c67305117c 100644 --- a/test/phpunit/CommonObjectTest.php +++ b/test/phpunit/CommonObjectTest.php @@ -116,7 +116,9 @@ class CommonObjectTest extends PHPUnit_Framework_TestCase /** + * testVerifyNumRef * + * @return void */ public function testVerifyNumRef() { @@ -136,7 +138,9 @@ class CommonObjectTest extends PHPUnit_Framework_TestCase } /** + * testFetchUser * + * @return void */ public function testFetchUser() { @@ -157,7 +161,9 @@ class CommonObjectTest extends PHPUnit_Framework_TestCase } /** + * testFetchProjet * + * @return void */ public function testFetchProjet() { @@ -177,7 +183,9 @@ class CommonObjectTest extends PHPUnit_Framework_TestCase } /** + * testFetchThirdParty * + * @return void */ public function testFetchThirdParty() { diff --git a/test/phpunit/CoreTest.php b/test/phpunit/CoreTest.php index a0eeb7404cc3357cbb2ac75bb33bcdf859fe46f9..7ca6b78856b954d995452cd8fa0c7a4cc545e9f9 100755 --- a/test/phpunit/CoreTest.php +++ b/test/phpunit/CoreTest.php @@ -40,6 +40,8 @@ if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is /** + * Class to test core functions + * * @backupGlobals disabled * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. @@ -114,6 +116,9 @@ class CoreTest extends PHPUnit_Framework_TestCase /** + * testDetectURLROOT + * + * @return void */ public function testDetectURLROOT() { diff --git a/test/phpunit/DateLibTest.php b/test/phpunit/DateLibTest.php index 3a9c15db3eeee8bf36d3f41c8f7602a4e6c62218..222fb62a86af2511ff0aa959c7aedad5dca2a2f1 100644 --- a/test/phpunit/DateLibTest.php +++ b/test/phpunit/DateLibTest.php @@ -113,7 +113,10 @@ class DateLibTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } - /** + /** + * testConvertTime2Seconds + * + * @return void */ public function testConvertTime2Seconds() { @@ -131,6 +134,9 @@ class DateLibTest extends PHPUnit_Framework_TestCase } /** + * testConvertSecondToTime + * + * @return void */ public function testConvertSecondToTime() { @@ -153,7 +159,10 @@ class DateLibTest extends PHPUnit_Framework_TestCase } /** - */ + * testDolPrintDate + * + * @return void + */ public function testDolPrintDate() { global $conf,$user,$langs,$db; @@ -194,7 +203,10 @@ class DateLibTest extends PHPUnit_Framework_TestCase } /** - */ + * testDolTimePlusDuree + * + * @return int + */ public function testDolTimePlusDuree() { global $conf,$user,$langs,$db; @@ -216,7 +228,10 @@ class DateLibTest extends PHPUnit_Framework_TestCase } /** - */ + * testDolStringToTime + * + * @return int + */ public function testDolStringToTime() { global $conf,$user,$langs,$db; @@ -249,7 +264,10 @@ class DateLibTest extends PHPUnit_Framework_TestCase } /** - */ + * testDolGetFirstDay + * + * @return void + */ public function testDolGetFirstDay() { global $conf,$user,$langs,$db; diff --git a/test/phpunit/ImportTest.php b/test/phpunit/ImportTest.php index 693a83ecb4836e676cc8360dcb860ab3fb015919..aa31e015b9d00544a72e00dd2909f4e8c46f36ee 100755 --- a/test/phpunit/ImportTest.php +++ b/test/phpunit/ImportTest.php @@ -117,6 +117,9 @@ class ImportTest extends PHPUnit_Framework_TestCase /** + * testImportSample1 + * + * @return boolean */ public function testImportSample1() { diff --git a/test/phpunit/ModulesTest.php b/test/phpunit/ModulesTest.php index 6df87dde2f2bf74b9c58e95cc29370507a64d952..9b2924270e7326670d964ccef8e506bc5ca61adc 100755 --- a/test/phpunit/ModulesTest.php +++ b/test/phpunit/ModulesTest.php @@ -113,6 +113,9 @@ class ModulesTest extends PHPUnit_Framework_TestCase } /** + * testModulesInit + * + * @return int */ public function testModulesInit() { diff --git a/test/phpunit/PricesTest.php b/test/phpunit/PricesTest.php index 4554b6716922f4e5818b5970dccb68bd56ef5281..85cb2f3bbd53b28e018e6e10f95f3a3daf125e42 100755 --- a/test/phpunit/PricesTest.php +++ b/test/phpunit/PricesTest.php @@ -90,6 +90,9 @@ class PricesTest extends PHPUnit_Framework_TestCase } /** + * Init phpunit tests + * + * @return void */ protected function setUp() { @@ -101,7 +104,11 @@ class PricesTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + /** + * End phpunit tests + * + * @return void */ protected function tearDown() { @@ -121,21 +128,21 @@ class PricesTest extends PHPUnit_Framework_TestCase // qty=1, unit_price=1.24, discount_line=0, vat_rate=10, price_base_type='HT' $result1=calcul_price_total(1, 1.24, 0, 10, 0, 0, 0, 'HT', 0); // result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount) - + print __METHOD__." value0=1.24 result0=".$result1[0]."\n"; $this->assertEquals(1.24,$result1[0]); print __METHOD__." value1=0.12 result1=".$result1[1]."\n"; $this->assertEquals(0.12,$result1[1]); print __METHOD__." value2=1.36 result2=".$result1[2]."\n"; $this->assertEquals(1.36,$result1[2]); - + print __METHOD__." value3=1.24 result3=".$result1[3]."\n"; $this->assertEquals(1.24, $result1[3]); print __METHOD__." value4=0.124 result4=".$result1[4]."\n"; $this->assertEquals(0.124,$result1[4]); print __METHOD__." value5=1.364 result5=".$result1[5]."\n"; $this->assertEquals(1.364,$result1[5]); - + print __METHOD__." value6=1.24 result6=".$result1[6]."\n"; $this->assertEquals(1.24,$result1[6]); print __METHOD__." value7=0.12 result7=".$result1[7]."\n"; diff --git a/test/phpunit/ProductTest.php b/test/phpunit/ProductTest.php index 7e3f36e6adaf9803003ff1b20a916d5b46188281..7faae6bd33329f5c323700365ce2816e03be5574 100755 --- a/test/phpunit/ProductTest.php +++ b/test/phpunit/ProductTest.php @@ -92,6 +92,9 @@ class ProductTest extends PHPUnit_Framework_TestCase } /** + * Init phpunit tests + * + * @return void */ protected function setUp() { @@ -103,7 +106,11 @@ class ProductTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + /** + * End phpunit tests + * + * @return void */ protected function tearDown() { @@ -111,6 +118,9 @@ class ProductTest extends PHPUnit_Framework_TestCase } /** + * testProductCreate + * + * @return void */ public function testProductCreate() { diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index 30f1936d9854ea7bc2d58edc0a178cd00d7566a2..f4deb98b7a3024b782c6ab7aefdea72b61485bc0 100755 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -101,6 +101,9 @@ class SecurityTest extends PHPUnit_Framework_TestCase } /** + * Init phpunit tests + * + * @return void */ protected function setUp() { @@ -114,6 +117,9 @@ class SecurityTest extends PHPUnit_Framework_TestCase } /** + * End phpunit tests + * + * @return void */ protected function tearDown() { diff --git a/test/phpunit/SocieteTest.php b/test/phpunit/SocieteTest.php index 889e473ea259da24d4efc681b779e784024e8f95..050488a6e65895bc65c745153ad53fcbf1e9f6ba 100755 --- a/test/phpunit/SocieteTest.php +++ b/test/phpunit/SocieteTest.php @@ -93,6 +93,9 @@ class SocieteTest extends PHPUnit_Framework_TestCase } /** + * Init phpunit tests + * + * @return void */ protected function setUp() { @@ -104,7 +107,11 @@ class SocieteTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + /** + * End phpunit tests + * + * @return void */ protected function tearDown() { diff --git a/test/phpunit/UserGroupTest.php b/test/phpunit/UserGroupTest.php index e12b341758852d5c3c317399fdb56f158f942f86..537f47792b9a827902f7e31d208f2cacf4315d87 100644 --- a/test/phpunit/UserGroupTest.php +++ b/test/phpunit/UserGroupTest.php @@ -89,6 +89,9 @@ class UserGroupTest extends PHPUnit_Framework_TestCase } /** + * Init phpunit tests + * + * @return void */ protected function setUp() { @@ -100,7 +103,11 @@ class UserGroupTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + /** + * End phpunit tests + * + * @return void */ protected function tearDown() { diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php index 6234007761f462234f19d0240f3ab0e0d11fd2c7..df7aa47987aad10de04db78c1f46d648aa07d5db 100644 --- a/test/phpunit/UserTest.php +++ b/test/phpunit/UserTest.php @@ -89,6 +89,9 @@ class UserTest extends PHPUnit_Framework_TestCase } /** + * Init phpunit tests + * + * @return void */ protected function setUp() { @@ -100,7 +103,11 @@ class UserTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + /** + * End phpunit tests + * + * @return void */ protected function tearDown() { diff --git a/test/phpunit/WebservicesTest.php b/test/phpunit/WebservicesTest.php index 4b18be9f0245f3baac43e647ae32cc8de2190781..10e8b57a384e925274668329203420ad03c4453b 100755 --- a/test/phpunit/WebservicesTest.php +++ b/test/phpunit/WebservicesTest.php @@ -91,6 +91,9 @@ class WebservicesTest extends PHPUnit_Framework_TestCase } /** + * Init phpunit tests + * + * @return void */ protected function setUp() { @@ -102,16 +105,23 @@ class WebservicesTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + /** + * End phpunit tests + * + * @return void */ protected function tearDown() { print __METHOD__."\n"; } - /** + /** + * testWSVersion + * + * @return int */ - public function testWSVersion() + public function testWSGetVersions() { global $conf,$user,$langs,$db; $conf=$this->savconf;