This commit is contained in:
Laurent Destailleur 2012-02-15 13:41:05 +01:00
parent 0b7cbb50ac
commit 1810189cda
16 changed files with 247 additions and 48 deletions

View File

@ -114,6 +114,9 @@ class AdherentTest extends PHPUnit_Framework_TestCase
} }
/** /**
* testAdherentCreate
*
* @return void
*/ */
public function testAdherentCreate() 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 * @depends testAdherentCreate
* The depends says test is run only if previous is ok * 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 * @depends testAdherentFetch
* The depends says test is run only if previous is ok * 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 * @depends testAdherentUpdate
* The depends says test is run only if previous is ok * 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 * @depends testAdherentValid
* The depends says test is run only if previous is ok * 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 * @depends testAdherentOther
* The depends says test is run only if previous is ok * The depends says test is run only if previous is ok
*/ */
@ -278,24 +306,5 @@ class AdherentTest extends PHPUnit_Framework_TestCase
return $result; 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;
}*/
} }
?> ?>

View File

@ -29,12 +29,15 @@ global $conf,$user,$langs,$db;
require_once 'PHPUnit/Autoload.php'; require_once 'PHPUnit/Autoload.php';
require_once dirname(__FILE__).'/../../htdocs/master.inc.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/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/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/comm/propal/class/propal.class.php';
require_once dirname(__FILE__).'/../../htdocs/fichinter/class/fichinter.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/expedition/class/expedition.class.php';
require_once dirname(__FILE__).'/../../htdocs/projet/class/project.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/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/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_crabe.modules.php';
require_once dirname(__FILE__).'/../../htdocs/core/modules/facture/doc/pdf_oursin.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'; require_once dirname(__FILE__).'/../../htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php';
// Mother classes of pdf generators // Mother classes of pdf generators
require_once dirname(__FILE__).'/../../htdocs/core/modules/facture/modules_facture.php'; 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/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/propale/modules_propale.php';
require_once dirname(__FILE__).'/../../htdocs/core/modules/project/modules_project.php'; require_once dirname(__FILE__).'/../../htdocs/core/modules/project/modules_project.php';
require_once dirname(__FILE__).'/../../htdocs/core/modules/fichinter/modules_fichinter.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() 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() public function testCommandeBuild()
{ {
@ -209,7 +248,39 @@ class BuildDocTest extends PHPUnit_Framework_TestCase
return 0; 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() public function testPropalBuild()
{ {
@ -242,6 +313,9 @@ class BuildDocTest extends PHPUnit_Framework_TestCase
} }
/** /**
* testProjectBuild
*
* @return int
*/ */
public function testProjectBuild() public function testProjectBuild()
{ {
@ -267,6 +341,9 @@ class BuildDocTest extends PHPUnit_Framework_TestCase
} }
/** /**
* testFichinterBuild
*
* @return int
*/ */
public function testFichinterBuild() public function testFichinterBuild()
{ {
@ -292,6 +369,9 @@ class BuildDocTest extends PHPUnit_Framework_TestCase
} }
/** /**
* testExpeditionBuild
*
* @return int
*/ */
public function testExpeditionBuild() public function testExpeditionBuild()
{ {

View File

@ -114,6 +114,9 @@ class CMailFileTest extends PHPUnit_Framework_TestCase
} }
/** /**
* testCMailFileText
*
* @return void
*/ */
public function testCMailFileText() public function testCMailFileText()
{ {
@ -134,6 +137,9 @@ class CMailFileTest extends PHPUnit_Framework_TestCase
} }
/** /**
* testCMailFileStatic
*
* @return string
*/ */
public function testCMailFileStatic() public function testCMailFileStatic()
{ {

View File

@ -115,6 +115,9 @@ class CategorieTest extends PHPUnit_Framework_TestCase
} }
/** /**
* testCategorieCreate
*
* @return int
*/ */
public function testCategorieCreate() public function testCategorieCreate()
{ {
@ -138,6 +141,11 @@ class CategorieTest extends PHPUnit_Framework_TestCase
} }
/** /**
* testCategorieProduct
*
* @param int $id Id of category
* @return int
*
* @depends testCategorieCreate * @depends testCategorieCreate
* The depends says test is run only if previous is ok * 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 * @depends testCategorieProduct
* The depends says test is run only if previous is ok * 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 * @depends testCategorieFetch
* The depends says test is run only if previous is ok * The depends says test is run only if previous is ok
*/ */
@ -213,25 +231,11 @@ class CategorieTest extends PHPUnit_Framework_TestCase
} }
/** /**
* @depends testCategorieUpdate * testCategorieOther
* The depends says test is run only if previous is ok *
*/ * @param Category $localobject Category
/*public function testCategorieXXX($localobject) * @return int
{ *
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;
}*/
/**
* @depends testCategorieUpdate * @depends testCategorieUpdate
* The depends says test is run only if previous is ok * 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 * @depends testCategorieOther
* The depends says test is run only if previous is ok * 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 * @depends testCategorieDelete
*/ */
public function testCategorieStatic() public function testCategorieStatic()

View File

@ -116,7 +116,9 @@ class CommonObjectTest extends PHPUnit_Framework_TestCase
/** /**
* testVerifyNumRef
* *
* @return void
*/ */
public function testVerifyNumRef() public function testVerifyNumRef()
{ {
@ -136,7 +138,9 @@ class CommonObjectTest extends PHPUnit_Framework_TestCase
} }
/** /**
* testFetchUser
* *
* @return void
*/ */
public function testFetchUser() public function testFetchUser()
{ {
@ -157,7 +161,9 @@ class CommonObjectTest extends PHPUnit_Framework_TestCase
} }
/** /**
* testFetchProjet
* *
* @return void
*/ */
public function testFetchProjet() public function testFetchProjet()
{ {
@ -177,7 +183,9 @@ class CommonObjectTest extends PHPUnit_Framework_TestCase
} }
/** /**
* testFetchThirdParty
* *
* @return void
*/ */
public function testFetchThirdParty() public function testFetchThirdParty()
{ {

View File

@ -40,6 +40,8 @@ if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is
/** /**
* Class to test core functions
*
* @backupGlobals disabled * @backupGlobals disabled
* @backupStaticAttributes enabled * @backupStaticAttributes enabled
* @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. * @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() public function testDetectURLROOT()
{ {

View File

@ -113,7 +113,10 @@ class DateLibTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
/** /**
* testConvertTime2Seconds
*
* @return void
*/ */
public function testConvertTime2Seconds() public function testConvertTime2Seconds()
{ {
@ -131,6 +134,9 @@ class DateLibTest extends PHPUnit_Framework_TestCase
} }
/** /**
* testConvertSecondToTime
*
* @return void
*/ */
public function testConvertSecondToTime() public function testConvertSecondToTime()
{ {
@ -153,7 +159,10 @@ class DateLibTest extends PHPUnit_Framework_TestCase
} }
/** /**
*/ * testDolPrintDate
*
* @return void
*/
public function testDolPrintDate() public function testDolPrintDate()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
@ -194,7 +203,10 @@ class DateLibTest extends PHPUnit_Framework_TestCase
} }
/** /**
*/ * testDolTimePlusDuree
*
* @return int
*/
public function testDolTimePlusDuree() public function testDolTimePlusDuree()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
@ -216,7 +228,10 @@ class DateLibTest extends PHPUnit_Framework_TestCase
} }
/** /**
*/ * testDolStringToTime
*
* @return int
*/
public function testDolStringToTime() public function testDolStringToTime()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
@ -249,7 +264,10 @@ class DateLibTest extends PHPUnit_Framework_TestCase
} }
/** /**
*/ * testDolGetFirstDay
*
* @return void
*/
public function testDolGetFirstDay() public function testDolGetFirstDay()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@ -117,6 +117,9 @@ class ImportTest extends PHPUnit_Framework_TestCase
/** /**
* testImportSample1
*
* @return boolean
*/ */
public function testImportSample1() public function testImportSample1()
{ {

View File

@ -113,6 +113,9 @@ class ModulesTest extends PHPUnit_Framework_TestCase
} }
/** /**
* testModulesInit
*
* @return int
*/ */
public function testModulesInit() public function testModulesInit()
{ {

View File

@ -90,6 +90,9 @@ class PricesTest extends PHPUnit_Framework_TestCase
} }
/** /**
* Init phpunit tests
*
* @return void
*/ */
protected function setUp() protected function setUp()
{ {
@ -101,7 +104,11 @@ class PricesTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
/** /**
* End phpunit tests
*
* @return void
*/ */
protected function tearDown() protected function tearDown()
{ {

View File

@ -92,6 +92,9 @@ class ProductTest extends PHPUnit_Framework_TestCase
} }
/** /**
* Init phpunit tests
*
* @return void
*/ */
protected function setUp() protected function setUp()
{ {
@ -103,7 +106,11 @@ class ProductTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
/** /**
* End phpunit tests
*
* @return void
*/ */
protected function tearDown() protected function tearDown()
{ {
@ -111,6 +118,9 @@ class ProductTest extends PHPUnit_Framework_TestCase
} }
/** /**
* testProductCreate
*
* @return void
*/ */
public function testProductCreate() public function testProductCreate()
{ {

View File

@ -101,6 +101,9 @@ class SecurityTest extends PHPUnit_Framework_TestCase
} }
/** /**
* Init phpunit tests
*
* @return void
*/ */
protected function setUp() protected function setUp()
{ {
@ -114,6 +117,9 @@ class SecurityTest extends PHPUnit_Framework_TestCase
} }
/** /**
* End phpunit tests
*
* @return void
*/ */
protected function tearDown() protected function tearDown()
{ {

View File

@ -93,6 +93,9 @@ class SocieteTest extends PHPUnit_Framework_TestCase
} }
/** /**
* Init phpunit tests
*
* @return void
*/ */
protected function setUp() protected function setUp()
{ {
@ -104,7 +107,11 @@ class SocieteTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
/** /**
* End phpunit tests
*
* @return void
*/ */
protected function tearDown() protected function tearDown()
{ {

View File

@ -89,6 +89,9 @@ class UserGroupTest extends PHPUnit_Framework_TestCase
} }
/** /**
* Init phpunit tests
*
* @return void
*/ */
protected function setUp() protected function setUp()
{ {
@ -100,7 +103,11 @@ class UserGroupTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
/** /**
* End phpunit tests
*
* @return void
*/ */
protected function tearDown() protected function tearDown()
{ {

View File

@ -89,6 +89,9 @@ class UserTest extends PHPUnit_Framework_TestCase
} }
/** /**
* Init phpunit tests
*
* @return void
*/ */
protected function setUp() protected function setUp()
{ {
@ -100,7 +103,11 @@ class UserTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
/** /**
* End phpunit tests
*
* @return void
*/ */
protected function tearDown() protected function tearDown()
{ {

View File

@ -91,6 +91,9 @@ class WebservicesTest extends PHPUnit_Framework_TestCase
} }
/** /**
* Init phpunit tests
*
* @return void
*/ */
protected function setUp() protected function setUp()
{ {
@ -102,16 +105,23 @@ class WebservicesTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
/** /**
* End phpunit tests
*
* @return void
*/ */
protected function tearDown() protected function tearDown()
{ {
print __METHOD__."\n"; print __METHOD__."\n";
} }
/** /**
* testWSVersion
*
* @return int
*/ */
public function testWSVersion() public function testWSGetVersions()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$conf=$this->savconf; $conf=$this->savconf;