Merge remote-tracking branch 'uptream/develop' into 6.0-pcard

This commit is contained in:
Alexandre SPANGARO 2017-05-22 06:32:59 +02:00
commit 7520a55498
21 changed files with 82 additions and 1824 deletions

File diff suppressed because it is too large Load Diff

View File

@ -569,7 +569,7 @@ class Account extends CommonObject
$sql.= ", '".$this->db->escape($this->label)."'"; $sql.= ", '".$this->db->escape($this->label)."'";
$sql.= ", ".$conf->entity; $sql.= ", ".$conf->entity;
$sql.= ", '".$this->db->escape($this->account_number)."'"; $sql.= ", '".$this->db->escape($this->account_number)."'";
$sql.= ", '".$this->db->escape($this->fk_accountancy_journal)."'"; $sql.= ", ".($this->fk_accountancy_journal > 0 ? $this->db->escape($this->fk_accountancy_journal) : "null");
$sql.= ", '".$this->db->escape($this->bank)."'"; $sql.= ", '".$this->db->escape($this->bank)."'";
$sql.= ", '".$this->code_banque."'"; $sql.= ", '".$this->code_banque."'";
$sql.= ", '".$this->code_guichet."'"; $sql.= ", '".$this->code_guichet."'";
@ -702,8 +702,7 @@ class Account extends CommonObject
$sql.= ",rappro = ".$this->rappro; $sql.= ",rappro = ".$this->rappro;
$sql.= ",url = ".($this->url?"'".$this->url."'":"null"); $sql.= ",url = ".($this->url?"'".$this->url."'":"null");
$sql.= ",account_number = '".$this->db->escape($this->account_number)."'"; $sql.= ",account_number = '".$this->db->escape($this->account_number)."'";
$sql.= ",fk_accountancy_journal = '".$this->db->escape($this->fk_accountancy_journal)."'"; $sql.= ",fk_accountancy_journal = ".($this->fk_accountancy_journal > 0 ? $this->db->escape($this->fk_accountancy_journal) : "null");
$sql.= ",bank = '".$this->db->escape($this->bank)."'"; $sql.= ",bank = '".$this->db->escape($this->bank)."'";
$sql.= ",code_banque='".$this->db->escape($this->code_banque)."'"; $sql.= ",code_banque='".$this->db->escape($this->code_banque)."'";
$sql.= ",code_guichet='".$this->db->escape($this->code_guichet)."'"; $sql.= ",code_guichet='".$this->db->escape($this->code_guichet)."'";

View File

@ -657,6 +657,7 @@ function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists)
* @param string $destfile Destination file (can't be a directory. use native php @rename() to move a directory) * @param string $destfile Destination file (can't be a directory. use native php @rename() to move a directory)
* @param integer $newmask Mask in octal string for new file (0 by default means $conf->global->MAIN_UMASK) * @param integer $newmask Mask in octal string for new file (0 by default means $conf->global->MAIN_UMASK)
* @param int $overwriteifexists Overwrite file if exists (1 by default) * @param int $overwriteifexists Overwrite file if exists (1 by default)
* @param int $testvirus Do an antivirus test. Move is canceled if a virus is found.
* @return boolean True if OK, false if KO * @return boolean True if OK, false if KO
* @see dol_move_uploaded_file * @see dol_move_uploaded_file
*/ */
@ -1624,12 +1625,12 @@ function dol_compress_file($inputfile, $outputfile, $mode="gz")
*/ */
function dol_uncompress($inputfile,$outputdir) function dol_uncompress($inputfile,$outputdir)
{ {
global $conf, $langs; global $langs;
if (! empty($conf->global->ODTPHP_PATHTOPCLZIP)) if (defined('ODTPHP_PATHTOPCLZIP'))
{ {
dol_syslog("Constant ODTPHP_PATHTOPCLZIP for pclzip library is set to ".$conf->global->ODTPHP_PATHTOPCLZIP.", so we use Pclzip to unzip into ".$outputdir); dol_syslog("Constant ODTPHP_PATHTOPCLZIP for pclzip library is set to ".ODTPHP_PATHTOPCLZIP.", so we use Pclzip to unzip into ".$outputdir);
include_once $conf->global->ODTPHP_PATHTOPCLZIP.'/pclzip.lib.php'; include_once ODTPHP_PATHTOPCLZIP.'/pclzip.lib.php';
$archive = new PclZip($inputfile); $archive = new PclZip($inputfile);
$result=$archive->extract(PCLZIP_OPT_PATH, $outputdir); $result=$archive->extract(PCLZIP_OPT_PATH, $outputdir);
//var_dump($result); //var_dump($result);
@ -1698,7 +1699,7 @@ function dol_most_recent_file($dir,$regexfilter='',$excludefilter=array('(\.meta
* @param string $entity Restrict onto entity (0=no restriction) * @param string $entity Restrict onto entity (0=no restriction)
* @param User $fuser User object (forced) * @param User $fuser User object (forced)
* @param string $refname Ref of object to check permission for external users (autodetect if not provided) * @param string $refname Ref of object to check permission for external users (autodetect if not provided)
* @param string $more Check permission for 'read' or 'write' * @param string $mode Check permission for 'read' or 'write'
* @return mixed Array with access information : 'accessallowed' & 'sqlprotectagainstexternals' & 'original_file' (as a full path name) * @return mixed Array with access information : 'accessallowed' & 'sqlprotectagainstexternals' & 'original_file' (as a full path name)
* @see restrictedArea * @see restrictedArea
*/ */

View File

@ -281,7 +281,7 @@ function GETPOST($paramname, $check='', $method=0, $filter=NULL, $options=NULL)
$relativepathstring = preg_replace('/^\//', '', $relativepathstring); $relativepathstring = preg_replace('/^\//', '', $relativepathstring);
// Retrieve values if restore_lastsearch_values is set and there is saved values // Retrieve values if restore_lastsearch_values is set and there is saved values
if ($_GET['restore_lastsearch_values'] && ! empty($_SESSION['lastsearch_values_'.$relativepathstring])) // Keep $_GET here if (! empty($_GET['restore_lastsearch_values']) && ! empty($_SESSION['lastsearch_values_'.$relativepathstring])) // Keep $_GET here
{ {
$tmp=json_decode($_SESSION['lastsearch_values_'.$relativepathstring], true); $tmp=json_decode($_SESSION['lastsearch_values_'.$relativepathstring], true);
if (is_array($tmp)) if (is_array($tmp))
@ -615,19 +615,20 @@ function dol_buildpath($path, $type=0)
} }
/** /**
* Create a clone of instance of object (new instance with same properties) * Create a clone of instance of object (new instance with same value for properties)
* This function works for both PHP4 and PHP5 * Property that are reference are also new object (true clone)
* *
* @param object $object Object to clone * @param object $object Object to clone
* @return object Object clone * @return object Object clone
* @deprecated Dolibarr no longer supports PHP4, use PHP5 native clone construct
* @see https://php.net/manual/language.oop5.cloning.php * @see https://php.net/manual/language.oop5.cloning.php
*/ */
function dol_clone($object) function dol_clone($object)
{ {
dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); //dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
//$myclone = clone $object; // PHP clone is a shallow copy only, not a real clone, so properties of references will keep references (refer to the same target/variable
$myclone=unserialize(serialize($object));
$myclone = clone $object;
return $myclone; return $myclone;
} }

View File

@ -781,7 +781,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
} }
// Personalized field {XXX-1} à {XXX-9} // Personalized field {XXX-1} à {XXX-9}
$maskperso=array(); /*$maskperso=array();
$maskpersonew=array(); $maskpersonew=array();
$tmpmask=$mask; $tmpmask=$mask;
while (preg_match('/\{([A-Z]+)\-([1-9])\}/i',$tmpmask,$regKey)) while (preg_match('/\{([A-Z]+)\-([1-9])\}/i',$tmpmask,$regKey))
@ -789,17 +789,17 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
$maskperso[$regKey[1]]='\{'.$regKey[1]+'\-'.$regKey[2].'\}'; $maskperso[$regKey[1]]='\{'.$regKey[1]+'\-'.$regKey[2].'\}';
$maskpersonew[$regKey[1]]=str_pad('', '_', $regKey[2], STR_PAD_RIGHT); $maskpersonew[$regKey[1]]=str_pad('', '_', $regKey[2], STR_PAD_RIGHT);
$tmpmask=preg_replace('/\{'.$regKey[1].'\-'.$regKey[2].'\}/i', $maskpersonew, $tmpmask); $tmpmask=preg_replace('/\{'.$regKey[1].'\-'.$regKey[2].'\}/i', $maskpersonew, $tmpmask);
} }*/
$maskwithonlyymcode=$mask; $maskwithonlyymcode=$mask;
$maskwithonlyymcode=preg_replace('/\{(0+)([@\+][0-9\-\+\=]+)?([@\+][0-9\-\+\=]+)?\}/i',$maskcounter,$maskwithonlyymcode); $maskwithonlyymcode=preg_replace('/\{(0+)([@\+][0-9\-\+\=]+)?([@\+][0-9\-\+\=]+)?\}/i',$maskcounter,$maskwithonlyymcode);
$maskwithonlyymcode=preg_replace('/\{dd\}/i','dd',$maskwithonlyymcode); $maskwithonlyymcode=preg_replace('/\{dd\}/i','dd',$maskwithonlyymcode);
$maskwithonlyymcode=preg_replace('/\{(c+)(0*)\}/i',$maskrefclient,$maskwithonlyymcode); $maskwithonlyymcode=preg_replace('/\{(c+)(0*)\}/i',$maskrefclient,$maskwithonlyymcode);
$maskwithonlyymcode=preg_replace('/\{(t+)\}/i',$masktype_value,$maskwithonlyymcode); $maskwithonlyymcode=preg_replace('/\{(t+)\}/i',$masktype_value,$maskwithonlyymcode);
foreach($maskperso as $key => $val) /*foreach($maskperso as $key => $val)
{ {
$maskwithonlyymcode=preg_replace('/'.$val.'/i', $maskpersonew[$key], $maskwithonlyymcode); $maskwithonlyymcode=preg_replace('/'.$val.'/i', $maskpersonew[$key], $maskwithonlyymcode);
} }*/
$maskwithnocode=$maskwithonlyymcode; $maskwithnocode=$maskwithonlyymcode;
$maskwithnocode=preg_replace('/\{yyyy\}/i','yyyy',$maskwithnocode); $maskwithnocode=preg_replace('/\{yyyy\}/i','yyyy',$maskwithnocode);
$maskwithnocode=preg_replace('/\{yy\}/i','yy',$maskwithnocode); $maskwithnocode=preg_replace('/\{yy\}/i','yy',$maskwithnocode);

View File

@ -848,7 +848,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if (! $resql) $err++; if (! $resql) $err++;
$note=json_encode(array('authorid'=>$user->id, 'ip'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR']))); $note=json_encode(array('authorid'=>(is_object($user)?$user->id:0), 'ip'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR'])));
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name, value, visible, entity, note) VALUES"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name, value, visible, entity, note) VALUES";
$sql.= " (".$this->db->encrypt($this->const_name,1); $sql.= " (".$this->db->encrypt($this->const_name,1);

View File

@ -841,7 +841,7 @@ class Societe extends CommonObject
$sql .= ",fk_effectif = ".(! empty($this->effectif_id)?"'".$this->db->escape($this->effectif_id)."'":"null"); $sql .= ",fk_effectif = ".(! empty($this->effectif_id)?"'".$this->db->escape($this->effectif_id)."'":"null");
if (isset($this->stcomm_id)) if (isset($this->stcomm_id))
{ {
$sql .= ",fk_stcomm=".($this->stcomm_id > 0 ? $this->stcomm_id : "null"); $sql .= ",fk_stcomm=".($this->stcomm_id > 0 ? $this->stcomm_id : "0");
} }
$sql .= ",fk_typent = ".(! empty($this->typent_id)?"'".$this->db->escape($this->typent_id)."'":"0"); $sql .= ",fk_typent = ".(! empty($this->typent_id)?"'".$this->db->escape($this->typent_id)."'":"0");

View File

@ -83,6 +83,8 @@ class AdherentTest extends PHPUnit_Framework_TestCase
print "\n".__METHOD__." Company must be setup to have name-firstname in order 'Firstname Lastname'\n"; print "\n".__METHOD__." Company must be setup to have name-firstname in order 'Firstname Lastname'\n";
die(); die();
} }
if (! empty($conf->global->MAIN_MODULE_LDAP)) { print "\n".__METHOD__." module LDAP must be disabled.\n"; die(); }
if (! empty($conf->global->MAIN_MODULE_MAILMANSPIP)) { print "\n".__METHOD__." module MailmanSpip must be disabled.\n"; die(); }
print __METHOD__."\n"; print __METHOD__."\n";
} }
@ -320,6 +322,7 @@ class AdherentTest extends PHPUnit_Framework_TestCase
'%ADDRESS%,%ZIP%,%TOWN%,%COUNTRY%,%EMAIL%,%BIRTH%,%PHOTO%,%LOGIN%,%PASSWORD%,%PRENOM%,'. '%ADDRESS%,%ZIP%,%TOWN%,%COUNTRY%,%EMAIL%,%BIRTH%,%PHOTO%,%LOGIN%,%PASSWORD%,%PRENOM%,'.
'%NOM%,%SOCIETE%,%ADDRESS%,%ZIP%,%TOWN%,%COUNTRY%'; '%NOM%,%SOCIETE%,%ADDRESS%,%ZIP%,%TOWN%,%COUNTRY%';
// If option to store clear password has been set, we get 'dolibspec' into PASSWORD field.
$expected = DOL_MAIN_URL_ROOT.','.$localobject->id.',,New firstname,New name,New firstname New name,'. $expected = DOL_MAIN_URL_ROOT.','.$localobject->id.',,New firstname,New name,New firstname New name,'.
'New company,New address,New zip,New town,Belgium,newemail@newemail.com,'.dol_print_date($localobject->birth,'day').',,'. 'New company,New address,New zip,New town,Belgium,newemail@newemail.com,'.dol_print_date($localobject->birth,'day').',,'.
'newlogin,dolibspec,New firstname,New name,New company,New address,New zip,New town,Belgium'; 'newlogin,dolibspec,New firstname,New name,New company,New address,New zip,New town,Belgium';

View File

@ -432,9 +432,16 @@ class FilesLibTest extends PHPUnit_Framework_TestCase
$langs=$this->savlangs; $langs=$this->savlangs;
$db=$this->savdb; $db=$this->savdb;
//$dummyuser=new User($db); //$dummyuser=new User($db);
//$result=restrictedArea($dummyuser,'societe'); //$result=restrictedArea($dummyuser,'societe');
// We save user properties
$savpermlire = $user->rights->facture->lire;
$savpermcreer = $user->rights->facture->creer;
// Check access to SPECIMEN
$user->rights->facture->lire = 0; $user->rights->facture->lire = 0;
$user->rights->facture->creer = 0; $user->rights->facture->creer = 0;
$filename='SPECIMEN.pdf'; // Filename relative to module part $filename='SPECIMEN.pdf'; // Filename relative to module part
@ -473,6 +480,11 @@ class FilesLibTest extends PHPUnit_Framework_TestCase
$filename='FA010101/FA010101.pdf'; // Filename relative to module part $filename='FA010101/FA010101.pdf'; // Filename relative to module part
$result=dol_check_secure_access_document('facture', $filename, 0, '', '', 'write'); $result=dol_check_secure_access_document('facture', $filename, 0, '', '', 'write');
$this->assertEquals(0,$result['accessallowed']); $this->assertEquals(0,$result['accessallowed']);
// We restore user properties
$user->rights->facture->lire = $savpermlire;
$user->rights->facture->creer = $savpermcreer;
} }
} }

View File

@ -81,6 +81,8 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
//$db->begin(); // This is to have all actions inside a transaction even if test launched without suite. //$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
if (! function_exists('mb_substr')) { print "\n".__METHOD__." function mb_substr must be enabled.\n"; die(); }
print __METHOD__."\n"; print __METHOD__."\n";
} }

View File

@ -143,6 +143,11 @@ class ModulesTest extends PHPUnit_Framework_TestCase
$result=$mod->init(); $result=$mod->init();
$this->assertLessThan($result, 0, $modlabel); $this->assertLessThan($result, 0, $modlabel);
print __METHOD__." test remove/init for module ".$modlabel.", result=".$result."\n"; print __METHOD__." test remove/init for module ".$modlabel.", result=".$result."\n";
if (in_array($modlabel, array('Ldap', 'MailmanSpip')))
{
$result=$mod->remove();
}
} }
return 0; return 0;

View File

@ -144,14 +144,16 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
$localobject->date=dol_mktime(12, 0, 0, 1, 1, 1915); // we use year 1915 to be sure to not have existing invoice for this year $localobject->date=dol_mktime(12, 0, 0, 1, 1, 1915); // we use year 1915 to be sure to not have existing invoice for this year
$numbering=new mod_facture_mercure(); $numbering=new mod_facture_mercure();
$result=$numbering->getNextValue($mysoc, $localobject); $result=$numbering->getNextValue($mysoc, $localobject);
$result2=$localobject->create($user,1);
$result3=$localobject->validate($user, $result); // create invoice by forcing ref
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertEquals('1915-0001', $result, 'Test for {yyyy}-{0000}, 1st invoice'); // counter must start to 1 $this->assertEquals('1915-0001', $result, 'Test for {yyyy}-{0000}, 1st invoice'); // counter must start to 1
$result2=$localobject->create($user,1);
print __METHOD__." result2=".$result."\n";
$result3=$localobject->validate($user, $result); // create invoice by forcing ref
print __METHOD__." result3=".$result."\n";
$this->assertEquals(1, $result3, 'Test validation of invoice with forced ref is ok'); // counter must start to 1
$result=$localobject->is_erasable(); $result=$localobject->is_erasable();
print __METHOD__." is_erasable=".$result."\n"; print __METHOD__." is_erasable=".$result."\n";
$this->assertEquals(1, $result, 'Test for is_erasable, 1st invoice'); // Can be deleted $this->assertEquals(1, $result, 'Test for is_erasable, 1st invoice'); // Can be deleted
$localobject2=new Facture($this->savdb); $localobject2=new Facture($this->savdb);
$localobject2->initAsSpecimen(); $localobject2->initAsSpecimen();
$localobject2->date=dol_mktime(12, 0, 0, 1, 1, 1916); // we use following year for second invoice (there is no reset into mask) $localobject2->date=dol_mktime(12, 0, 0, 1, 1, 1916); // we use following year for second invoice (there is no reset into mask)
@ -160,10 +162,13 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertEquals('1915-0001', $result, "Test to get last value with param 'last'"); $this->assertEquals('1915-0001', $result, "Test to get last value with param 'last'");
$result=$numbering->getNextValue($mysoc, $localobject2); $result=$numbering->getNextValue($mysoc, $localobject2);
$result2=$localobject2->create($user,1);
$result3=$localobject2->validate($user, $result); // create invoice by forcing ref
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertEquals('1916-0002', $result); // counter must be now 2 (not reseted) $this->assertEquals('1916-0002', $result); // counter must be now 2 (not reseted)
$result2=$localobject2->create($user,1);
print __METHOD__." result2=".$result."\n";
$result3=$localobject2->validate($user, $result); // create invoice by forcing ref
print __METHOD__." result3=".$result."\n";
$this->assertEquals(1, $result3, 'Test validation of invoice with forced ref is ok'); // counter must start to 1
$result=$localobject2->is_erasable(); $result=$localobject2->is_erasable();
print __METHOD__." is_erasable=".$result."\n"; print __METHOD__." is_erasable=".$result."\n";
$this->assertEquals(1, $result); // Can be deleted $this->assertEquals(1, $result); // Can be deleted

View File

@ -79,7 +79,7 @@ class SocieteTest extends PHPUnit_Framework_TestCase
if ($conf->global->SOCIETE_CODECLIENT_ADDON != 'mod_codeclient_monkey') { print "\n".__METHOD__." third party ref checker must be setup to 'mod_codeclient_monkey' not to '".$conf->global->SOCIETE_CODECLIENT_ADDON."'.\n"; die(); } if ($conf->global->SOCIETE_CODECLIENT_ADDON != 'mod_codeclient_monkey') { print "\n".__METHOD__." third party ref checker must be setup to 'mod_codeclient_monkey' not to '".$conf->global->SOCIETE_CODECLIENT_ADDON."'.\n"; die(); }
if (! empty($conf->global->MAIN_DISABLEPROFIDRULES)) { print "\n".__METHOD__." constant MAIN_DISABLEPROFIDRULE must be empty (if a module set it, disable module).\n"; die(); } if (! empty($conf->global->MAIN_DISABLEPROFIDRULES)) { print "\n".__METHOD__." constant MAIN_DISABLEPROFIDRULES must be empty (if a module set it, disable module).\n"; die(); }
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite. $db->begin(); // This is to have all actions inside a transaction even if test launched without suite.

View File

@ -75,6 +75,9 @@ class UserTest extends PHPUnit_Framework_TestCase
public static function setUpBeforeClass() public static function setUpBeforeClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
if (! empty($conf->global->MAIN_MODULE_LDAP)) { print "\n".__METHOD__." module LDAP must be disabled.\n"; die(); }
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite. $db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
print __METHOD__."\n"; print __METHOD__."\n";
@ -187,7 +190,7 @@ class UserTest extends PHPUnit_Framework_TestCase
$newlocalobject=new User($this->savdb); $newlocalobject=new User($this->savdb);
$newlocalobject->initAsSpecimen(); $newlocalobject->initAsSpecimen();
$this->changeProperties($newlocalobject); $this->changeProperties($newlocalobject);
$this->assertEquals($this->objCompare($localobject,$newlocalobject,true,array('id','socid','societe_id','ref','pass_indatabase','pass_indatabase_crypted','datec','datem','datelastlogin','datepreviouslogin')), array()); // Actual, Expected $this->assertEquals($this->objCompare($localobject,$newlocalobject,true,array('id','socid','societe_id','ref','pass','pass_indatabase','pass_indatabase_crypted','datec','datem','datelastlogin','datepreviouslogin')), array()); // Actual, Expected
return $localobject; return $localobject;
} }

View File

@ -39,6 +39,8 @@ if (empty($user->id))
} }
$conf->global->MAIN_DISABLE_ALL_MAILS=1; $conf->global->MAIN_DISABLE_ALL_MAILS=1;
$conf->global->MAIN_UMASK='0666';
/** /**
* Class for PHPUnit tests * Class for PHPUnit tests

View File

@ -38,6 +38,8 @@ if (empty($user->id)) {
} }
$conf->global->MAIN_DISABLE_ALL_MAILS=1; $conf->global->MAIN_DISABLE_ALL_MAILS=1;
$conf->global->MAIN_UMASK='0666';
/** /**
* Class for PHPUnit tests * Class for PHPUnit tests

View File

@ -38,6 +38,8 @@ if (empty($user->id)) {
} }
$conf->global->MAIN_DISABLE_ALL_MAILS=1; $conf->global->MAIN_DISABLE_ALL_MAILS=1;
$conf->global->MAIN_UMASK='0666';
/** /**
* Class for PHPUnit tests * Class for PHPUnit tests

View File

@ -40,6 +40,8 @@ if (empty($user->id)) {
} }
$conf->global->MAIN_DISABLE_ALL_MAILS=1; $conf->global->MAIN_DISABLE_ALL_MAILS=1;
$conf->global->MAIN_UMASK='0666';
if (empty($conf->service->enabled)) if (empty($conf->service->enabled))
{ {
print "Error: Module service must be enabled.\n"; print "Error: Module service must be enabled.\n";
@ -167,7 +169,9 @@ class WebservicesProductsTest extends PHPUnit_Framework_TestCase
'ref'=>'NewProductFromWS'.$datestring, 'ref'=>'NewProductFromWS'.$datestring,
'label'=>'New Product From WS '.$datestring, 'label'=>'New Product From WS '.$datestring,
'type'=>1, 'type'=>1,
'description'=>'This is a new product created from WS PHPUnit test case' 'description'=>'This is a new product created from WS PHPUnit test case',
'barcode'=>'123456789012',
'barcode_type'=>2
) )
); );
print __METHOD__." call method ".$WS_METHOD."\n"; print __METHOD__." call method ".$WS_METHOD."\n";

View File

@ -38,6 +38,8 @@ if (empty($user->id)) {
} }
$conf->global->MAIN_DISABLE_ALL_MAILS=1; $conf->global->MAIN_DISABLE_ALL_MAILS=1;
$conf->global->MAIN_UMASK='0666';
/** /**
* Class for PHPUnit tests * Class for PHPUnit tests

View File

@ -38,6 +38,8 @@ if (empty($user->id)) {
} }
$conf->global->MAIN_DISABLE_ALL_MAILS=1; $conf->global->MAIN_DISABLE_ALL_MAILS=1;
$conf->global->MAIN_UMASK='0666';
/** /**
* Class for PHPUnit tests * Class for PHPUnit tests