This commit is contained in:
Laurent Destailleur 2012-02-17 16:02:35 +01:00
parent 61e226fe43
commit 9b3bab5ff9
15 changed files with 259 additions and 216 deletions

View File

@ -621,7 +621,7 @@ function dol_syslog($message, $level=LOG_INFO)
// database or config file because we must be able to log data before database or config file read.
$oldinclude=get_include_path();
set_include_path('/usr/share/php/');
require_once('FirePHPCore/FirePHP.class.php');
include_once('FirePHPCore/FirePHP.class.php');
set_include_path($oldinclude);
ob_start();
$firephp = FirePHP::getInstance(true);

View File

@ -114,6 +114,9 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase
}
/**
* testChargeSocialesCreate
*
* @return void
*/
public function testChargeSocialesCreate()
{
@ -133,6 +136,11 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase
}
/**
* testChargeSocialesFetch
*
* @param int $id Id of social contribution
* @return void
*
* @depends testChargeSocialesCreate
* The depends says test is run only if previous is ok
*/
@ -153,27 +161,11 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase
}
/**
* @depends testChargeSocialesFetch
* The depends says test is run only if previous is ok
*/
/* public function testChargeSocialesUpdate($localobject)
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
$localobject->note='New note after update';
$result=$localobject->update($user);
print __METHOD__." id=".$localobject->id." result=".$result."\n";
$this->assertLessThan($result, 0);
return $localobject;
}
*/
/**
* testChargeSocialesValid
*
* @param Object $localobject Social contribution
* @return void
*
* @depends testChargeSocialesFetch
* The depends says test is run only if previous is ok
*/
@ -193,6 +185,11 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase
}
/**
* testChargeSocialesOther
*
* @param Object $localobject Social contribution
* @return void
*
* @depends testChargeSocialesValid
* The depends says test is run only if previous is ok
*/
@ -212,10 +209,15 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase
print __METHOD__." id=".$localobject->id." result=".$result."\n";
$this->assertLessThanOrEqual($result, 0);
return $localobject->id;
return $localobject->id;
}
/**
* testChargeSocialesDelete
*
* @param int $id Social contribution
* @return void
*
* @depends testChargeSocialesOther
* The depends says test is run only if previous is ok
*/
@ -236,26 +238,5 @@ class ChargeSocialesTest 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 ChargeSociales($this->savdb);
$result=$localobject->ref='refthatdoesnotexists';
$result=$localobject->VerifyNumRef();
print __METHOD__." result=".$result."\n";
$this->assertEquals($result, 0);
return $result;
}*/
}
?>

View File

@ -116,6 +116,9 @@ class CommandeFournisseurTest extends PHPUnit_Framework_TestCase
}
/**
* testCommandeFournisseurCreate
*
* @return void
*/
public function testCommandeFournisseurCreate()
{
@ -135,6 +138,11 @@ class CommandeFournisseurTest extends PHPUnit_Framework_TestCase
}
/**
* testCommandeFournisseurFetch
*
* @param int $id Id of supplier order
* @return void
*
* @depends testCommandeFournisseurCreate
* The depends says test is run only if previous is ok
*/
@ -153,28 +161,13 @@ class CommandeFournisseurTest extends PHPUnit_Framework_TestCase
$this->assertLessThan($result, 0);
return $localobject;
}
/**
* @depends testCommandeFournisseurFetch
* The depends says test is run only if previous is ok
*/
/* public function testCommandeFournisseurUpdate($localobject)
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
$localobject->note='New note after update';
$result=$localobject->update($user);
print __METHOD__." id=".$localobject->id." result=".$result."\n";
$this->assertLessThan($result, 0);
return $localobject->id;
}
*/
/**
* testCommandeFournisseurValid
*
* @param Object $localobject Supplier order
* @return void
*
* @depends testCommandeFournisseurFetch
* The depends says test is run only if previous is ok
*/
@ -194,6 +187,11 @@ class CommandeFournisseurTest extends PHPUnit_Framework_TestCase
}
/**
* testCommandeFournisseurCancel
*
* @param Object $localobject Supplier order
* @return void
*
* @depends testCommandeFournisseurValid
* The depends says test is run only if previous is ok
*/
@ -213,6 +211,11 @@ class CommandeFournisseurTest extends PHPUnit_Framework_TestCase
}
/**
* testCommandeFournisseurOther
*
* @param Object $localobject Supplier order
* @return void
*
* @depends testCommandeFournisseurCancel
* The depends says test is run only if previous is ok
*/
@ -238,6 +241,11 @@ class CommandeFournisseurTest extends PHPUnit_Framework_TestCase
}
/**
* testCommandeFournisseurDelete
*
* @param int $id Id of order
* @return void
*
* @depends testCommandeFournisseurOther
* The depends says test is run only if previous is ok
*/
@ -259,7 +267,9 @@ class CommandeFournisseurTest extends PHPUnit_Framework_TestCase
}
/**
* testVerifyNumRef
*
* @return void
*/
public function testVerifyNumRef()
{

View File

@ -115,6 +115,9 @@ class CommandeTest extends PHPUnit_Framework_TestCase
}
/**
* testCommandeCreate
*
* @return void
*/
public function testCommandeCreate()
{
@ -134,6 +137,9 @@ class CommandeTest extends PHPUnit_Framework_TestCase
}
/**
* testCommandeFetch
* @param int $id Id order
*
* @depends testCommandeCreate
* The depends says test is run only if previous is ok
*/
@ -154,26 +160,11 @@ class CommandeTest extends PHPUnit_Framework_TestCase
}
/**
* @depends testCommandeFetch
* The depends says test is run only if previous is ok
*/
/* public function testCommandeUpdate($localobject)
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
$localobject->note='New note after update';
$result=$localobject->update($user);
print __METHOD__." id=".$localobject->id." result=".$result."\n";
$this->assertLessThan($result, 0);
return $localobject->id;
}
*/
/**
* testCommandeValid
*
* @param Object $localobject Order
* @return void
*
* @depends testCommandeFetch
* The depends says test is run only if previous is ok
*/
@ -193,6 +184,11 @@ class CommandeTest extends PHPUnit_Framework_TestCase
}
/**
* testCommandeCancel
*
* @param Object $localobject Order
* @return void
*
* @depends testCommandeValid
* The depends says test is run only if previous is ok
*/
@ -212,6 +208,11 @@ class CommandeTest extends PHPUnit_Framework_TestCase
}
/**
* testCommandeOther
*
* @param Object $localobject Order
* @return void
*
* @depends testCommandeCancel
* The depends says test is run only if previous is ok
*/
@ -236,6 +237,11 @@ class CommandeTest extends PHPUnit_Framework_TestCase
}
/**
* testCommandeDelete
*
* @param int $id Id of order
* @return void
*
* @depends testCommandeOther
* The depends says test is run only if previous is ok
*/
@ -257,7 +263,9 @@ class CommandeTest extends PHPUnit_Framework_TestCase
}
/**
* testVerifyNumRef
*
* @return void
*/
public function testVerifyNumRef()
{

View File

@ -115,6 +115,9 @@ class CompanyBankAccountTest extends PHPUnit_Framework_TestCase
}
/**
* testCompanyBankAccountCreate
*
* @return int
*/
public function testCompanyBankAccountCreate()
{
@ -134,6 +137,11 @@ class CompanyBankAccountTest extends PHPUnit_Framework_TestCase
}
/**
* testCompanyBankAccountFetch
*
* @param int $id Id of bank account
* @return void
*
* @depends testCompanyBankAccountCreate
* The depends says test is run only if previous is ok
*/
@ -154,6 +162,10 @@ class CompanyBankAccountTest extends PHPUnit_Framework_TestCase
}
/**
* testCompanyBankAccountUpdate
*
* @param Object $localobject Bank account object
*
* @depends testCompanyBankAccountFetch
* The depends says test is run only if previous is ok
*/
@ -174,6 +186,11 @@ class CompanyBankAccountTest extends PHPUnit_Framework_TestCase
}
/**
* testCompanyBankAccountOther
*
* @param Object $localobject Bank account
* @return int
*
* @depends testCompanyBankAccountFetch
* The depends says test is run only if previous is ok
*/
@ -193,26 +210,5 @@ class CompanyBankAccountTest extends PHPUnit_Framework_TestCase
return $localobject->id;
}
/**
* @depends testCompanyBankAccountOther
* The depends says test is run only if previous is ok
*/
/* public function testCompanyBankAccountDelete($id)
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
$localobject=new CompanyBankAccount($this->savdb);
$result=$localobject->fetch($id);
$result=$localobject->delete($user);
print __METHOD__." id=".$id." result=".$result."\n";
$this->assertLessThan($result, 0);
return $result;
}
*/
}
?>

View File

@ -116,6 +116,9 @@ class ContactTest extends PHPUnit_Framework_TestCase
}
/**
* testContactCreate
*
* @return int
*/
public function testContactCreate()
{
@ -136,6 +139,9 @@ class ContactTest extends PHPUnit_Framework_TestCase
}
/**
* testContactFetch
*
* @param int Id of contact
* @depends testContactCreate
* The depends says test is run only if previous is ok
*/

View File

@ -114,6 +114,9 @@ class ContratTest extends PHPUnit_Framework_TestCase
}
/**
* testContratCreate
*
* @return int
*/
public function testContratCreate()
{
@ -134,6 +137,11 @@ class ContratTest extends PHPUnit_Framework_TestCase
}
/**
* testContratFetch
*
* @param int $id Id of contract
* @return int
*
* @depends testContratCreate
* The depends says test is run only if previous is ok
*/
@ -155,27 +163,11 @@ class ContratTest extends PHPUnit_Framework_TestCase
}
/**
* @depends testContratFetch
* The depends says test is run only if previous is ok
*/
/* public function testContratUpdate($localobject)
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
$localobject->note='New note after update';
$result=$localobject->update($user);
print __METHOD__." id=".$localobject->id." result=".$result."\n";
$this->assertLessThan($result, 0);
return $localobject;
}
*/
/**
* testContratValid
*
* @param int $id Id of contract
* @return int
*
* @depends testContratFetch
* The depends says test is run only if previous is ok
*/
@ -195,6 +187,11 @@ class ContratTest extends PHPUnit_Framework_TestCase
}
/**
* testContratValid
*
* @param Object $localobject Object contract
* @return int
*
* @depends testContratValid
* The depends says test is run only if previous is ok
*/
@ -219,6 +216,11 @@ class ContratTest extends PHPUnit_Framework_TestCase
}
/**
* testContratDelete
*
* @param int $id Id of contract
* @return int
*
* @depends testContratOther
* The depends says test is run only if previous is ok
*/
@ -241,7 +243,9 @@ class ContratTest extends PHPUnit_Framework_TestCase
/**
* testVerifyNumRef
*
* @return int
*/
public function testVerifyNumRef()
{

View File

@ -115,6 +115,9 @@ class DiscountTest extends PHPUnit_Framework_TestCase
}
/**
* testDiscountCreate
*
* @return int
*/
public function testDiscountCreate()
{
@ -134,6 +137,11 @@ class DiscountTest extends PHPUnit_Framework_TestCase
}
/**
* testDiscountFetch
*
* @param int $id Id of discount
* @return int
*
* @depends testDiscountCreate
* The depends says test is run only if previous is ok
*/
@ -154,6 +162,10 @@ class DiscountTest extends PHPUnit_Framework_TestCase
}
/**
* testDiscountDelete
*
* @param int $id Id of discount
*
* @depends testDiscountFetch
* The depends says test is run only if previous is ok
*/

View File

@ -89,8 +89,11 @@ class FactureTestRounding extends PHPUnit_Framework_TestCase
}
/**
* Init phpunit tests
*
* @return void
*/
protected function setUp()
protected function setUp()
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
@ -100,9 +103,13 @@ class FactureTestRounding extends PHPUnit_Framework_TestCase
print __METHOD__."\n";
}
/**
* End phpunit tests
*
* @return void
*/
protected function tearDown()
protected function tearDown()
{
print __METHOD__."\n";
}
@ -110,6 +117,7 @@ class FactureTestRounding extends PHPUnit_Framework_TestCase
/**
* testFactureRoundingCreate1
* Test according to page http://wiki.dolibarr.org/index.php/Draft:VAT_calculation_and_rounding#Standard_usage
*
* @return int
@ -148,10 +156,12 @@ class FactureTestRounding extends PHPUnit_Framework_TestCase
/**
* testFactureRoundingCreate2
*
* @return int
*
* @depends testFactureRoundingCreate1
* Test according to page http://wiki.dolibarr.org/index.php/Draft:VAT_calculation_and_rounding#Standard_usage
*
* @return int
*/
public function testFactureRoundingCreate2()
{

View File

@ -290,8 +290,8 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
$result=dol_mktime(2,0,0,1,1,1970,0); // 1970-01-01 02:00:00 in local area Europe/Paris -> 3600 GMT
print __METHOD__." result=".$result."\n";
$tz=getServerTimeZoneInt('1970-01-01 02:00:00'); // +1 in Europe/Paris at this time (we are winter)
$this->assertEquals(7200-($tz*3600),$result); // Should be 7200 if we are at greenwich
$tz=getServerTimeZoneInt('1970-01-01 02:00:00'); // +1 in Europe/Paris at this time (this time is winter)
$this->assertEquals(7200-($tz*3600),$result); // Should be 7200 if we are at greenwich winter
}
/**

View File

@ -119,7 +119,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
/**
* Test function calcul_price_total
*
* @return boolean
* @return boolean
* @see http://wiki.dolibarr.org/index.php/Draft:VAT_calculation_and_rounding#Standard_usage
*/
public function testCalculPriceTotal()
@ -157,7 +157,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
/**
* Test function addline and update_price
*
* @return boolean
* @return boolean
* @see http://wiki.dolibarr.org/index.php/Draft:VAT_calculation_and_rounding#Standard_usage
*/
public function testUpdatePrice()
@ -199,7 +199,6 @@ class PricesTest extends PHPUnit_Framework_TestCase
$this->assertEquals(2.48,$newlocalobject->total_ht);
//$this->assertEquals(0.25,$newlocalobject->total_tva);
//$this->assertEquals(2.73,$newlocalobject->total_ttc);
}
}

View File

@ -141,6 +141,10 @@ class ProductTest extends PHPUnit_Framework_TestCase
}
/**
* testProductFetch
*
* @param int $id Id product
*
* @depends testProductCreate
* The depends says test is run only if previous is ok
*/
@ -161,6 +165,11 @@ class ProductTest extends PHPUnit_Framework_TestCase
}
/**
* testProductUpdate
*
* @param Product $localobject Product
* @return void
*
* @depends testProductFetch
* The depends says test is run only if previous is ok
*/
@ -181,6 +190,11 @@ class ProductTest extends PHPUnit_Framework_TestCase
}
/**
* testProductOther
*
* @param Product $localobject Product
* @return void
*
* @depends testProductUpdate
* The depends says test is run only if previous is ok
*/
@ -197,6 +211,11 @@ class ProductTest extends PHPUnit_Framework_TestCase
}
/**
* testProductDelete
*
* @param int $id Id of product
* @return void
*
* @depends testProductOther
* The depends says test is run only if previous is ok
*/
@ -219,27 +238,9 @@ class ProductTest extends PHPUnit_Framework_TestCase
}
/**
*
*/
/*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;
}*/
/**
* testProductStatic
*
* @return void
*/
public function testProductStatic()
{

View File

@ -115,6 +115,9 @@ class PropalTest extends PHPUnit_Framework_TestCase
}
/**
* testPropalCreate
*
* @return void
*/
public function testPropalCreate()
{
@ -134,6 +137,11 @@ class PropalTest extends PHPUnit_Framework_TestCase
}
/**
* testPropalFetch
*
* @param int $id Id of object
* @return void
*
* @depends testPropalCreate
* The depends says test is run only if previous is ok
*/
@ -154,26 +162,11 @@ class PropalTest extends PHPUnit_Framework_TestCase
}
/**
* @depends testPropalFetch
* The depends says test is run only if previous is ok
*/
/* public function testPropalUpdate($localobject)
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
$localobject->note='New note after update';
$result=$localobject->update($user);
print __METHOD__." id=".$localobject->id." result=".$result."\n";
$this->assertLessThan($result, 0);
return $localobject->id;
}
*/
/**
* testPropalValid
*
* @param Proposal $localobject Proposal
* @return Proposal
*
* @depends testPropalFetch
* The depends says test is run only if previous is ok
*/
@ -193,6 +186,11 @@ class PropalTest extends PHPUnit_Framework_TestCase
}
/**
* testPropalOther
*
* @param Proposal $localobject Proposal
* @return int
*
* @depends testPropalValid
* The depends says test is run only if previous is ok
*/
@ -217,6 +215,11 @@ class PropalTest extends PHPUnit_Framework_TestCase
}
/**
* testPropalDelete
*
* @param int $id Id of proposal
* @return void
*
* @depends testPropalOther
* The depends says test is run only if previous is ok
*/
@ -238,7 +241,9 @@ class PropalTest extends PHPUnit_Framework_TestCase
}
/**
* testVerifyNumRef
*
* @return void
*/
public function testVerifyNumRef()
{

View File

@ -115,6 +115,9 @@ class UserGroupTest extends PHPUnit_Framework_TestCase
}
/**
* testUserGroupCreate
*
* @return void
*/
public function testUserGroupCreate()
{
@ -134,6 +137,10 @@ class UserGroupTest extends PHPUnit_Framework_TestCase
}
/**
* testUserGroupFetch
*
* @param int $id Id of group
* @return void
* @depends testUserGroupCreate
* The depends says test is run only if previous is ok
*/
@ -154,6 +161,10 @@ class UserGroupTest extends PHPUnit_Framework_TestCase
}
/**
* testUserGroupUpdate
*
* @param Object $localobject Group
* @return void
* @depends testUserGroupFetch
* The depends says test is run only if previous is ok
*/
@ -174,6 +185,10 @@ class UserGroupTest extends PHPUnit_Framework_TestCase
}
/**
* testUserGroupAddRight
*
* @param Object $localobject Object to show
* @return void
* @depends testUserGroupUpdate
* The depends says test is run only if previous is ok
*/
@ -193,6 +208,10 @@ class UserGroupTest extends PHPUnit_Framework_TestCase
}
/**
* testUserGroupDelRight
*
* @param Object $localobject Object
* @return void
* @depends testUserGroupAddRight
* The depends says test is run only if previous is ok
*/
@ -212,6 +231,10 @@ class UserGroupTest extends PHPUnit_Framework_TestCase
}
/**
* testUserGroupOther
*
* @param Object $localobject Object
* @return void
* @depends testUserGroupDelRight
* The depends says test is run only if previous is ok
*/
@ -236,6 +259,10 @@ class UserGroupTest extends PHPUnit_Framework_TestCase
}
/**
* testUserGroupDelete
*
* @param int $id Id of object
* @return void
* @depends testUserGroupOther
* The depends says test is run only if previous is ok
*/
@ -256,24 +283,5 @@ class UserGroupTest 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 UserGroup($this->savdb);
$result=$localobject->ref='refthatdoesnotexists';
$result=$localobject->VerifyNumRef();
print __METHOD__." result=".$result."\n";
$this->assertEquals($result, 0);
return $result;
}*/
}
?>

View File

@ -115,6 +115,9 @@ class UserTest extends PHPUnit_Framework_TestCase
}
/**
* testUserCreate
*
* @return void
*/
public function testUserCreate()
{
@ -134,6 +137,10 @@ class UserTest extends PHPUnit_Framework_TestCase
}
/**
* testUserFetch
*
* @param int $id Id of user
* @return void
* @depends testUserCreate
* The depends says test is run only if previous is ok
*/
@ -154,6 +161,10 @@ class UserTest extends PHPUnit_Framework_TestCase
}
/**
* testUserUpdate
*
* @param Object $localobject User
* @return void
* @depends testUserFetch
* The depends says test is run only if previous is ok
*/
@ -174,6 +185,10 @@ class UserTest extends PHPUnit_Framework_TestCase
}
/**
* testUserDisable
*
* @param Object $localobject User
* @return void
* @depends testUserUpdate
* The depends says test is run only if previous is ok
*/
@ -193,6 +208,10 @@ class UserTest extends PHPUnit_Framework_TestCase
}
/**
* testUserOther
*
* @param Object $localobject User
* @return void
* @depends testUserDisable
* The depends says test is run only if previous is ok
*/
@ -217,6 +236,10 @@ class UserTest extends PHPUnit_Framework_TestCase
}
/**
* testUserDelete
*
* @param Object $localobject User
* @return void
* @depends testUserOther
* The depends says test is run only if previous is ok
*/
@ -237,25 +260,5 @@ class UserTest 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 User($this->savdb);
$result=$localobject->ref='refthatdoesnotexists';
$result=$localobject->VerifyNumRef();
print __METHOD__." result=".$result."\n";
$this->assertEquals($result, 0);
return $result;
}*/
}
?>