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()
{
@ -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;
}*/
}
?>

View File

@ -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()
{

View File

@ -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()
{

View File

@ -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()

View File

@ -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()
{

View File

@ -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()
{

View File

@ -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;

View File

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

View File

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

View File

@ -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";

View File

@ -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()
{

View File

@ -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()
{

View File

@ -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()
{

View File

@ -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()
{

View File

@ -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()
{

View File

@ -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;