mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-09 19:18:22 +01:00
Fix travis error
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -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;
|
//$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));
|
||||||
|
|
||||||
return $myclone;
|
return $myclone;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2469,7 +2470,7 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodo
|
|||||||
if ($trunc == 'right')
|
if ($trunc == 'right')
|
||||||
{
|
{
|
||||||
$newstring=dol_textishtml($string)?dol_string_nohtmltag($string,1):$string;
|
$newstring=dol_textishtml($string)?dol_string_nohtmltag($string,1):$string;
|
||||||
if (dol_strlen($newstring,$stringencoding) > ($size+($nodot?0:1)))
|
if (dol_strlen($newstring,$stringencoding) > ($size+($nodot?0:1)))
|
||||||
return dol_substr($newstring,0,$size,$stringencoding).($nodot?'':'...');
|
return dol_substr($newstring,0,$size,$stringencoding).($nodot?'':'...');
|
||||||
else
|
else
|
||||||
return $string;
|
return $string;
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ class AllTests
|
|||||||
$suite->addTestSuite('BuildDocTest');
|
$suite->addTestSuite('BuildDocTest');
|
||||||
require_once dirname(__FILE__).'/CMailFileTest.php';
|
require_once dirname(__FILE__).'/CMailFileTest.php';
|
||||||
$suite->addTestSuite('CMailFileTest');
|
$suite->addTestSuite('CMailFileTest');
|
||||||
|
|
||||||
require_once dirname(__FILE__).'/CommonObjectTest.php';
|
require_once dirname(__FILE__).'/CommonObjectTest.php';
|
||||||
$suite->addTestSuite('CommonObjectTest');
|
$suite->addTestSuite('CommonObjectTest');
|
||||||
|
|
||||||
|
|||||||
@@ -431,10 +431,17 @@ class FilesLibTest extends PHPUnit_Framework_TestCase
|
|||||||
$user=$this->savuser;
|
$user=$this->savuser;
|
||||||
$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;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
|
|||||||
$user=$this->savuser;
|
$user=$this->savuser;
|
||||||
$langs=$this->savlangs;
|
$langs=$this->savlangs;
|
||||||
$db=$this->savdb;
|
$db=$this->savdb;
|
||||||
|
|
||||||
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/core/modules/facture/mod_facture_mercure.php';
|
require_once dirname(__FILE__).'/../../htdocs/core/modules/facture/mod_facture_mercure.php';
|
||||||
|
|
||||||
@@ -138,8 +138,8 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
|
|||||||
$conf->global->FACTURE_MERCURE_MASK_CREDIT='{yyyy}-{0000}';
|
$conf->global->FACTURE_MERCURE_MASK_CREDIT='{yyyy}-{0000}';
|
||||||
$conf->global->FACTURE_MERCURE_MASK_INVOICE='{yyyy}-{0000}';
|
$conf->global->FACTURE_MERCURE_MASK_INVOICE='{yyyy}-{0000}';
|
||||||
$conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED=0;
|
$conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED=0;
|
||||||
|
|
||||||
$localobject=new Facture($this->savdb);
|
$localobject=new Facture($this->savdb);
|
||||||
$localobject->initAsSpecimen();
|
$localobject->initAsSpecimen();
|
||||||
$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();
|
||||||
@@ -154,10 +154,6 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
|
|||||||
$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
|
||||||
|
|
||||||
$out=file_get_contents(DOL_DATA_ROOT.'/dolibarr.log');
|
|
||||||
print $out;
|
|
||||||
|
|
||||||
$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)
|
||||||
|
|||||||
Reference in New Issue
Block a user